Bug 1759768 - use standard lazy getters for cal services. r=darktrojan
Differential Revision: https://phabricator.services.mozilla.com/D141897 --HG-- extra : rebase_source : 04fa44e10268a8a15d1672f3c567ab773d25d7eb extra : histedit_source : 42ebdf5ffc87b7d2a0167d4a2ee020687e7955be
This commit is contained in:
Родитель
2e0edf0ee9
Коммит
48350ef5e2
|
@ -42,7 +42,7 @@ async function loadCalendarComponent() {
|
|||
}
|
||||
loadCalendarComponent.hasBeenCalled = true;
|
||||
|
||||
if (cal.getCalendarManager().wrappedJSObject.mCache) {
|
||||
if (cal.manager.wrappedJSObject.mCache) {
|
||||
cal.ASSERT(
|
||||
[...Services.wm.getEnumerator("mail:3pane")].length > 1,
|
||||
"Calendar manager initialised calendars before loadCalendarComponent ran on the first " +
|
||||
|
|
|
@ -30,8 +30,7 @@ function canPaste() {
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
let calendars = cal
|
||||
.getCalendarManager()
|
||||
let calendars = cal.manager
|
||||
.getCalendars()
|
||||
.filter(cal.acl.isCalendarWritable)
|
||||
.filter(cal.acl.userCanAddItemsToCalendar);
|
||||
|
@ -232,8 +231,7 @@ function pasteFromClipboard() {
|
|||
let validPasteText = pasteText != "paste" && !pasteText.endsWith("Item");
|
||||
pasteText += items.length == withAttendees.length ? "Only" : "Also";
|
||||
|
||||
let calendars = cal
|
||||
.getCalendarManager()
|
||||
let calendars = cal.manager
|
||||
.getCalendars()
|
||||
.filter(cal.acl.isCalendarWritable)
|
||||
.filter(cal.acl.userCanAddItemsToCalendar)
|
||||
|
|
|
@ -544,10 +544,7 @@ var calendarController = {
|
|||
* calendar.
|
||||
*/
|
||||
get writable() {
|
||||
return cal
|
||||
.getCalendarManager()
|
||||
.getCalendars()
|
||||
.some(cal.acl.isCalendarWritable);
|
||||
return cal.manager.getCalendars().some(cal.acl.isCalendarWritable);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -562,8 +559,7 @@ var calendarController = {
|
|||
* Returns a boolean indicating if all calendars are readonly.
|
||||
*/
|
||||
get all_readonly() {
|
||||
let calMgr = cal.getCalendarManager();
|
||||
return calMgr.readOnlyCalendarCount == calMgr.calendarCount;
|
||||
return cal.manager.readOnlyCalendarCount == cal.manager.calendarCount;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -572,8 +568,7 @@ var calendarController = {
|
|||
* or a file URL, but both are reloadable.
|
||||
*/
|
||||
get has_enabled_reloadable_calendars() {
|
||||
return cal
|
||||
.getCalendarManager()
|
||||
return cal.manager
|
||||
.getCalendars()
|
||||
.some(
|
||||
calendar =>
|
||||
|
@ -587,8 +582,7 @@ var calendarController = {
|
|||
* network access.
|
||||
*/
|
||||
get has_local_calendars() {
|
||||
let calMgr = cal.getCalendarManager();
|
||||
return calMgr.networkCalendarCount < calMgr.calendarCount;
|
||||
return cal.manager.networkCalendarCount < cal.manager.calendarCount;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -596,8 +590,7 @@ var calendarController = {
|
|||
* network access.
|
||||
*/
|
||||
get has_cached_calendars() {
|
||||
let calMgr = cal.getCalendarManager();
|
||||
let calendars = calMgr.getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
for (let calendar of calendars) {
|
||||
if (calendar.getProperty("cache.enabled") || calendar.getProperty("cache.always")) {
|
||||
return true;
|
||||
|
@ -610,7 +603,7 @@ var calendarController = {
|
|||
* Returns a boolean indicating that there is only one calendar left.
|
||||
*/
|
||||
get last_calendar() {
|
||||
return cal.getCalendarManager().calendarCount < 2;
|
||||
return cal.manager.calendarCount < 2;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -619,7 +612,7 @@ var calendarController = {
|
|||
get all_local_calendars_readonly() {
|
||||
// We might want to speed this part up by keeping track of this in the
|
||||
// calendar manager.
|
||||
let calendars = cal.getCalendarManager().getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
let count = calendars.length;
|
||||
for (let calendar of calendars) {
|
||||
if (!cal.acl.isCalendarWritable(calendar)) {
|
||||
|
@ -896,8 +889,7 @@ function deleteSelectedItems() {
|
|||
|
||||
function calendarUpdateNewItemsCommand() {
|
||||
// Re-calculate command status.
|
||||
let calendars = cal
|
||||
.getCalendarManager()
|
||||
let calendars = cal.manager
|
||||
.getCalendars()
|
||||
.filter(cal.acl.isCalendarWritable)
|
||||
.filter(cal.acl.userCanAddItemsToCalendar);
|
||||
|
|
|
@ -899,7 +899,7 @@ function invokeEventDragSession(aItem, aXULBox) {
|
|||
mutArray.appendElement(transfer);
|
||||
aXULBox.sourceObject = aItem;
|
||||
try {
|
||||
cal.getDragService().invokeDragSession(aXULBox, null, null, null, mutArray, action);
|
||||
cal.dragService.invokeDragSession(aXULBox, null, null, null, mutArray, action);
|
||||
} catch (e) {
|
||||
if (e.result != Cr.NS_ERROR_FAILURE) {
|
||||
// Pressing Escape on some platforms results in NS_ERROR_FAILURE
|
||||
|
|
|
@ -67,11 +67,11 @@ function openInvitationsDialog() {
|
|||
|
||||
function setUpInvitationsManager() {
|
||||
scheduleInvitationsUpdate(FIRST_DELAY_STARTUP);
|
||||
cal.getCalendarManager().addObserver(gInvitationsCalendarManagerObserver);
|
||||
cal.manager.addObserver(gInvitationsCalendarManagerObserver);
|
||||
}
|
||||
|
||||
function tearDownInvitationsManager() {
|
||||
cal.getCalendarManager().removeObserver(gInvitationsCalendarManagerObserver);
|
||||
cal.manager.removeObserver(gInvitationsCalendarManagerObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,7 @@ InvitationsManager.prototype = {
|
|||
this.deleteAllItems();
|
||||
|
||||
let streams = [];
|
||||
for (let calendar of cal.getCalendarManager().getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
if (!cal.acl.isCalendarWritable(calendar) || calendar.getProperty("disabled")) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,7 @@ function getSelectedCalendar() {
|
|||
* @param aCalendar The calendar to delete.
|
||||
*/
|
||||
function promptDeleteCalendar(aCalendar) {
|
||||
let calMgr = cal.getCalendarManager();
|
||||
let calendars = calMgr.getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
if (calendars.length <= 1) {
|
||||
// If this is the last calendar, don't delete it.
|
||||
return;
|
||||
|
@ -90,7 +89,7 @@ function promptDeleteCalendar(aCalendar) {
|
|||
removeFlags |= Ci.calICalendarManager.REMOVE_NO_DELETE;
|
||||
}
|
||||
|
||||
calMgr.removeCalendar(aCalendar, removeFlags);
|
||||
cal.manager.removeCalendar(aCalendar, removeFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +129,7 @@ function loadCalendarManager() {
|
|||
compositeCalendar.addObserver(compositeObserver);
|
||||
|
||||
// Create the home calendar if no calendar exists.
|
||||
let calendars = cal.getCalendarManager().getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
if (calendars.length) {
|
||||
// migration code to make sure calendars, which do not support caching have cache enabled
|
||||
// required to further clean up on top of bug 1182264
|
||||
|
@ -146,9 +145,7 @@ function loadCalendarManager() {
|
|||
initHomeCalendar();
|
||||
}
|
||||
|
||||
let calendarManager = cal.getCalendarManager();
|
||||
|
||||
for (let calendar of sortCalendarArray(calendarManager.getCalendars())) {
|
||||
for (let calendar of sortCalendarArray(cal.manager.getCalendars())) {
|
||||
addCalendarItem(calendar);
|
||||
}
|
||||
|
||||
|
@ -224,7 +221,7 @@ function loadCalendarManager() {
|
|||
|
||||
calendarList.addEventListener("click", event => {
|
||||
if (event.target.matches(".calendar-enable-button")) {
|
||||
let calendar = calendarManager.getCalendarById(
|
||||
let calendar = cal.manager.getCalendarById(
|
||||
event.target.closest("li").getAttribute("calendar-id")
|
||||
);
|
||||
calendar.setProperty("disabled", false);
|
||||
|
@ -238,7 +235,7 @@ function loadCalendarManager() {
|
|||
|
||||
let item = event.target.closest("li");
|
||||
let calendarId = item.getAttribute("calendar-id");
|
||||
let calendar = calendarManager.getCalendarById(calendarId);
|
||||
let calendar = cal.manager.getCalendarById(calendarId);
|
||||
|
||||
if (event.target.checked) {
|
||||
compositeCalendar.addCalendar(calendar);
|
||||
|
@ -267,7 +264,7 @@ function loadCalendarManager() {
|
|||
}
|
||||
|
||||
let calendarId = item.getAttribute("calendar-id");
|
||||
let calendar = calendarManager.getCalendarById(calendarId);
|
||||
let calendar = cal.manager.getCalendarById(calendarId);
|
||||
cal.window.openCalendarProperties(window, calendar);
|
||||
});
|
||||
calendarList.addEventListener("ordered", event => {
|
||||
|
@ -277,7 +274,7 @@ function loadCalendarManager() {
|
|||
calendarList.addEventListener("keypress", event => {
|
||||
let item = calendarList.rows[calendarList.selectedIndex];
|
||||
let calendarId = item.getAttribute("calendar-id");
|
||||
let calendar = calendarManager.getCalendarById(calendarId);
|
||||
let calendar = cal.manager.getCalendarById(calendarId);
|
||||
|
||||
switch (event.key) {
|
||||
case "Delete":
|
||||
|
@ -302,7 +299,7 @@ function loadCalendarManager() {
|
|||
calendarList.addEventListener("select", event => {
|
||||
let item = calendarList.rows[calendarList.selectedIndex];
|
||||
let calendarId = item.getAttribute("calendar-id");
|
||||
let calendar = calendarManager.getCalendarById(calendarId);
|
||||
let calendar = cal.manager.getCalendarById(calendarId);
|
||||
|
||||
compositeCalendar.defaultCalendar = calendar;
|
||||
});
|
||||
|
@ -377,7 +374,7 @@ function loadCalendarManager() {
|
|||
this.onPropertyChanged(calendar, name, null, null);
|
||||
},
|
||||
};
|
||||
calendarManager.addCalendarObserver(calendarList._calendarObserver);
|
||||
cal.manager.addCalendarObserver(calendarList._calendarObserver);
|
||||
|
||||
calendarList._calendarManagerObserver = {
|
||||
QueryInterface: ChromeUtils.generateQI(["calICalendarManagerObserver"]),
|
||||
|
@ -393,7 +390,7 @@ function loadCalendarManager() {
|
|||
},
|
||||
onCalendarDeleting(calendar) {},
|
||||
};
|
||||
calendarManager.addObserver(calendarList._calendarManagerObserver);
|
||||
cal.manager.addObserver(calendarList._calendarManagerObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -402,7 +399,7 @@ function loadCalendarManager() {
|
|||
function reportCalendars() {
|
||||
let telemetryReport = {};
|
||||
|
||||
for (let calendar of cal.getCalendarManager().getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
if (!telemetryReport[calendar.type]) {
|
||||
telemetryReport[calendar.type] = { count: 0, readOnlyCount: 0 };
|
||||
}
|
||||
|
@ -426,14 +423,13 @@ function reportCalendars() {
|
|||
* Creates the initial "Home" calendar if no calendar exists.
|
||||
*/
|
||||
function initHomeCalendar() {
|
||||
let calMgr = cal.getCalendarManager();
|
||||
let composite = cal.view.getCompositeCalendar(window);
|
||||
let url = Services.io.newURI("moz-storage-calendar://");
|
||||
let homeCalendar = calMgr.createCalendar("storage", url);
|
||||
let homeCalendar = cal.manager.createCalendar("storage", url);
|
||||
homeCalendar.name = cal.l10n.getCalString("homeCalendarName");
|
||||
homeCalendar.setProperty("disabled", true);
|
||||
|
||||
calMgr.registerCalendar(homeCalendar);
|
||||
cal.manager.registerCalendar(homeCalendar);
|
||||
Services.prefs.setStringPref("calendar.list.sortOrder", homeCalendar.id);
|
||||
composite.addCalendar(homeCalendar);
|
||||
|
||||
|
@ -459,9 +455,8 @@ function unloadCalendarManager() {
|
|||
compositeCalendar.removeObserver(compositeObserver);
|
||||
|
||||
let calendarList = document.getElementById("calendar-list");
|
||||
let calendarManager = cal.getCalendarManager();
|
||||
calendarManager.removeCalendarObserver(calendarList._calendarObserver);
|
||||
calendarManager.removeObserver(calendarList._calendarManagerObserver);
|
||||
cal.manager.removeCalendarObserver(calendarList._calendarObserver);
|
||||
cal.manager.removeObserver(calendarList._calendarManagerObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,7 +478,7 @@ function calendarListSetupContextMenu(event) {
|
|||
let calendarList = document.getElementById("calendar-list");
|
||||
calendarList.selectedIndex = calendarList.rows.indexOf(item);
|
||||
let calendarId = item.getAttribute("calendar-id");
|
||||
calendar = cal.getCalendarManager().getCalendarById(calendarId);
|
||||
calendar = cal.manager.getCalendarById(calendarId);
|
||||
}
|
||||
|
||||
document.getElementById("list-calendars-context-menu").contextCalendar = calendar;
|
||||
|
@ -574,7 +569,7 @@ function toggleCalendarVisible(aCalendar) {
|
|||
*/
|
||||
function showAllCalendars() {
|
||||
let composite = cal.view.getCompositeCalendar(window);
|
||||
let cals = cal.getCalendarManager().getCalendars();
|
||||
let cals = cal.manager.getCalendars();
|
||||
|
||||
composite.startBatch();
|
||||
for (let calendar of cals) {
|
||||
|
@ -667,11 +662,10 @@ function openLocalCalendar() {
|
|||
return;
|
||||
}
|
||||
|
||||
let calMgr = cal.getCalendarManager();
|
||||
let calendars = calMgr.getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
let calendar = calendars.find(x => x.uri.equals(picker.fileURL));
|
||||
if (!calendar) {
|
||||
calendar = calMgr.createCalendar("ics", picker.fileURL);
|
||||
calendar = cal.manager.createCalendar("ics", picker.fileURL);
|
||||
|
||||
// Strip ".ics" from filename for use as calendar name.
|
||||
let prettyName = picker.fileURL.spec.match(/([^/:]+)\.ics$/);
|
||||
|
@ -681,7 +675,7 @@ function openLocalCalendar() {
|
|||
calendar.name = cal.l10n.getCalString("untitledCalendarName");
|
||||
}
|
||||
|
||||
calMgr.registerCalendar(calendar);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
}
|
||||
|
||||
let calendarList = document.getElementById("calendar-list");
|
||||
|
|
|
@ -100,7 +100,6 @@ var gDataMigrator = {
|
|||
checkIcal() {
|
||||
function icalMigrate(aDataDir, aCallback) {
|
||||
aDataDir.append("Sources");
|
||||
let calManager = cal.getCalendarManager();
|
||||
|
||||
let i = 1;
|
||||
for (let dataDir of aDataDir.directoryEntries) {
|
||||
|
@ -155,7 +154,7 @@ var gDataMigrator = {
|
|||
let calendar = gDataMigrator.importICSToStorage(tempFile);
|
||||
calendar.name = "iCalendar" + i;
|
||||
i++;
|
||||
calManager.registerCalendar(calendar);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
cal.view.getCompositeCalendar(window).addCalendar(calendar);
|
||||
}
|
||||
console.debug("icalMig making callback");
|
||||
|
@ -194,13 +193,12 @@ var gDataMigrator = {
|
|||
if (dataStore.exists()) {
|
||||
let calendar = gDataMigrator.importICSToStorage(dataStore);
|
||||
calendar.name = "Evolution " + i++;
|
||||
calManager.registerCalendar(calendar);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
cal.view.getCompositeCalendar(window).addCalendar(calendar);
|
||||
}
|
||||
return dataStore.exists();
|
||||
};
|
||||
|
||||
let calManager = cal.getCalendarManager();
|
||||
for (let dataDir of aDataDir.directoryEntries) {
|
||||
let dataStore = dataDir.clone();
|
||||
dataStore.append("calendar.ics");
|
||||
|
@ -219,8 +217,6 @@ var gDataMigrator = {
|
|||
|
||||
checkWindowsMail() {
|
||||
function doMigrate(aCalendarNodes, aMailDir, aCallback) {
|
||||
let calManager = cal.getCalendarManager();
|
||||
|
||||
for (let node of aCalendarNodes) {
|
||||
let name = node.getElementsByTagName("Name")[0].textContent;
|
||||
let color = node.getElementsByTagName("Color")[0].textContent;
|
||||
|
@ -242,7 +238,7 @@ var gDataMigrator = {
|
|||
if (color) {
|
||||
storage.setProperty("color", color);
|
||||
}
|
||||
calManager.registerCalendar(storage);
|
||||
cal.manager.registerCalendar(storage);
|
||||
|
||||
if (enabled) {
|
||||
cal.view.getCompositeCalendar(window).addCalendar(storage);
|
||||
|
@ -296,7 +292,7 @@ var gDataMigrator = {
|
|||
*/
|
||||
importICSToStorage(icsFile) {
|
||||
const uri = "moz-storage-calendar://";
|
||||
let calendar = cal.getCalendarManager().createCalendar("storage", Services.io.newURI(uri));
|
||||
let calendar = cal.manager.createCalendar("storage", Services.io.newURI(uri));
|
||||
let icsImporter = Cc["@mozilla.org/calendar/import;1?type=ics"].getService(Ci.calIImporter);
|
||||
|
||||
let inputStream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
}
|
||||
|
||||
// Set up DOM attributes for custom CSS coloring.
|
||||
let weekTitle = cal.getWeekInfoService().getWeekTitle(aDate);
|
||||
let weekTitle = cal.weekInfoService.getWeekTitle(aDate);
|
||||
this.setAttribute("year", aDate.year);
|
||||
this.setAttribute("month", aDate.month + 1);
|
||||
this.setAttribute("week", weekTitle);
|
||||
|
@ -666,11 +666,9 @@
|
|||
this.rangeStartDate = startDate;
|
||||
this.rangeEndDate = endDate;
|
||||
|
||||
const viewStart = cal
|
||||
.getWeekInfoService()
|
||||
.getStartOfWeek(startDate.getInTimezone(this.mTimezone));
|
||||
const viewStart = cal.weekInfoService.getStartOfWeek(startDate.getInTimezone(this.mTimezone));
|
||||
|
||||
const viewEnd = cal.getWeekInfoService().getEndOfWeek(endDate.getInTimezone(this.mTimezone));
|
||||
const viewEnd = cal.weekInfoService.getEndOfWeek(endDate.getInTimezone(this.mTimezone));
|
||||
|
||||
viewStart.isDate = true;
|
||||
viewStart.makeImmutable();
|
||||
|
@ -950,7 +948,7 @@
|
|||
// Build and set the label.
|
||||
if (j == weekLabelColumnPos) {
|
||||
weekLabel.removeAttribute("hidden");
|
||||
const weekNumber = cal.getWeekInfoService().getWeekTitle(date);
|
||||
const weekNumber = cal.weekInfoService.getWeekTitle(date);
|
||||
const weekString = cal.l10n.getCalString("multiweekViewWeek", [weekNumber]);
|
||||
weekLabel.value = weekString;
|
||||
} else {
|
||||
|
|
|
@ -358,7 +358,7 @@ var calendarItemTabType = {
|
|||
|
||||
aState.args.onOk = doTransaction.bind(null, "modify");
|
||||
|
||||
aState.args.calendar = cal.getCalendarManager().getCalendarById(aState.calendarId);
|
||||
aState.args.calendar = cal.manager.getCalendarById(aState.calendarId);
|
||||
if (aState.args.calendar) {
|
||||
aState.args.calendar.getItem(aState.itemId).then(item => {
|
||||
if (item) {
|
||||
|
|
|
@ -105,10 +105,7 @@ function sortCalendarArray(calendars) {
|
|||
// check and repair pref when an array of all calendars has been passed:
|
||||
let sortOrderString = Services.prefs.getStringPref("calendar.list.sortOrder", "");
|
||||
let wantedOrderString = ret.map(calendar => calendar.id).join(" ");
|
||||
if (
|
||||
wantedOrderString != sortOrderString &&
|
||||
cal.getCalendarManager().getCalendars().length == ret.length
|
||||
) {
|
||||
if (wantedOrderString != sortOrderString && cal.manager.getCalendars().length == ret.length) {
|
||||
Services.prefs.setStringPref("calendar.list.sortOrder", wantedOrderString);
|
||||
}
|
||||
|
||||
|
@ -130,7 +127,7 @@ function sortCalendarArray(calendars) {
|
|||
*/
|
||||
function appendCalendarItems(aItem, aCalendarMenuParent, aCalendarToUse, aOnCommand) {
|
||||
let calendarToUse = aCalendarToUse || aItem.calendar;
|
||||
let calendars = sortCalendarArray(cal.getCalendarManager().getCalendars());
|
||||
let calendars = sortCalendarArray(cal.manager.getCalendars());
|
||||
let indexToSelect = 0;
|
||||
let index = -1;
|
||||
for (let i = 0; i < calendars.length; ++i) {
|
||||
|
|
|
@ -577,14 +577,14 @@ var calendarNavigationBar = {
|
|||
let docTitle = "";
|
||||
if (startDate) {
|
||||
let intervalLabel = document.getElementById("intervalDescription");
|
||||
let firstWeekNo = cal.getWeekInfoService().getWeekTitle(startDate);
|
||||
let firstWeekNo = cal.weekInfoService.getWeekTitle(startDate);
|
||||
let secondWeekNo = firstWeekNo;
|
||||
let weekLabel = document.getElementById("calendarWeek");
|
||||
if (startDate.nativeTime == endDate.nativeTime) {
|
||||
intervalLabel.value = cal.dtz.formatter.formatDate(startDate);
|
||||
} else {
|
||||
intervalLabel.value = currentView().getRangeDescription();
|
||||
secondWeekNo = cal.getWeekInfoService().getWeekTitle(endDate);
|
||||
secondWeekNo = cal.weekInfoService.getWeekTitle(endDate);
|
||||
}
|
||||
if (secondWeekNo == firstWeekNo) {
|
||||
weekLabel.value = cal.l10n.getCalString("singleShortCalendarWeek", [firstWeekNo]);
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
return;
|
||||
}
|
||||
date = date.getInTimezone(this.timezone);
|
||||
const weekStart = cal.getWeekInfoService().getStartOfWeek(date);
|
||||
const weekStart = cal.weekInfoService.getStartOfWeek(date);
|
||||
const weekEnd = weekStart.clone();
|
||||
weekEnd.day += 6;
|
||||
this.setDateRange(weekStart, weekEnd);
|
||||
|
@ -164,7 +164,7 @@
|
|||
// start of the week of the day that we're centering around
|
||||
// adjusted for the day the week starts on and the number
|
||||
// of previous weeks we're supposed to display.
|
||||
const dayStart = cal.getWeekInfoService().getStartOfWeek(date);
|
||||
const dayStart = cal.weekInfoService.getStartOfWeek(date);
|
||||
dayStart.day -= 7 * Services.prefs.getIntPref("calendar.previousweeks.inview", 0);
|
||||
|
||||
// The last day we're supposed to show.
|
||||
|
|
|
@ -90,9 +90,10 @@ var gCalendarTypes = new Map([
|
|||
// Create a local calendar to use, so we can share code with the calendar
|
||||
// preferences dialog.
|
||||
if (!gLocalCalendar) {
|
||||
gLocalCalendar = cal
|
||||
.getCalendarManager()
|
||||
.createCalendar("storage", Services.io.newURI("moz-storage-calendar://"));
|
||||
gLocalCalendar = cal.manager.createCalendar(
|
||||
"storage",
|
||||
Services.io.newURI("moz-storage-calendar://")
|
||||
);
|
||||
|
||||
initMailIdentitiesRow(gLocalCalendar);
|
||||
notifyOnIdentitySelection(gLocalCalendar);
|
||||
|
@ -641,7 +642,7 @@ function prepareLocalCalendar(calendar) {
|
|||
* Registers the local storage calendar and closes the dialog.
|
||||
*/
|
||||
function registerLocalCalendar() {
|
||||
cal.getCalendarManager().registerCalendar(prepareLocalCalendar(gLocalCalendar));
|
||||
cal.manager.registerCalendar(prepareLocalCalendar(gLocalCalendar));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -683,12 +684,7 @@ function findCalendars(password, savePassword = false) {
|
|||
function onDetectionSuccess(providerMap) {
|
||||
// Disable the calendars the user has already subscribed to. In the future
|
||||
// we should show a string when all calendars are already subscribed.
|
||||
let existing = new Set(
|
||||
cal
|
||||
.getCalendarManager()
|
||||
.getCalendars({})
|
||||
.map(calendar => calendar.uri.spec)
|
||||
);
|
||||
let existing = new Set(cal.manager.getCalendars({}).map(calendar => calendar.uri.spec));
|
||||
|
||||
let calendarsMap = new Map();
|
||||
for (let [provider, calendars] of providerMap.entries()) {
|
||||
|
@ -800,7 +796,7 @@ function prepareNetworkCalendar(calendar) {
|
|||
function createNetworkCalendars() {
|
||||
for (let listItem of document.getElementById("network-calendar-list").children) {
|
||||
if (listItem.querySelector(".calendar-selected").checked) {
|
||||
cal.getCalendarManager().registerCalendar(listItem.calendar);
|
||||
cal.manager.registerCalendar(listItem.calendar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
CalAttendee: "resource:///modules/CalAttendee.jsm",
|
||||
});
|
||||
|
||||
var freeBusyService = cal.getFreeBusyService();
|
||||
var timezoneService = cal.getTimezoneService();
|
||||
|
||||
var readOnly = false;
|
||||
|
||||
// The UI elements in this dialog. Initialised in the DOMContentLoaded handler.
|
||||
|
@ -646,37 +643,43 @@ function setLeftAndWidth(element, startTime, endTime) {
|
|||
pendingDiv.classList.add("pending");
|
||||
setLeftAndWidth(pendingDiv, from, to);
|
||||
|
||||
freeBusyService.getFreeBusyIntervals(calendar, from, to, Ci.calIFreeBusyInterval.BUSY_ALL, {
|
||||
onResult: (operation, results) => {
|
||||
for (let result of results) {
|
||||
let freeBusyType = Number(result.freeBusyType); // For some reason this is a string.
|
||||
if (freeBusyType == Ci.calIFreeBusyInterval.FREE) {
|
||||
continue;
|
||||
}
|
||||
cal.freeBusyService.getFreeBusyIntervals(
|
||||
calendar,
|
||||
from,
|
||||
to,
|
||||
Ci.calIFreeBusyInterval.BUSY_ALL,
|
||||
{
|
||||
onResult: (operation, results) => {
|
||||
for (let result of results) {
|
||||
let freeBusyType = Number(result.freeBusyType); // For some reason this is a string.
|
||||
if (freeBusyType == Ci.calIFreeBusyInterval.FREE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let block = this.freeBusyDiv.appendChild(document.createElement("div"));
|
||||
switch (freeBusyType) {
|
||||
case Ci.calIFreeBusyInterval.BUSY_TENTATIVE:
|
||||
block.classList.add("tentative");
|
||||
break;
|
||||
case Ci.calIFreeBusyInterval.BUSY_UNAVAILABLE:
|
||||
block.classList.add("unavailable");
|
||||
break;
|
||||
case Ci.calIFreeBusyInterval.UNKNOWN:
|
||||
block.classList.add("unknown");
|
||||
break;
|
||||
default:
|
||||
block.classList.add("busy");
|
||||
break;
|
||||
let block = this.freeBusyDiv.appendChild(document.createElement("div"));
|
||||
switch (freeBusyType) {
|
||||
case Ci.calIFreeBusyInterval.BUSY_TENTATIVE:
|
||||
block.classList.add("tentative");
|
||||
break;
|
||||
case Ci.calIFreeBusyInterval.BUSY_UNAVAILABLE:
|
||||
block.classList.add("unavailable");
|
||||
break;
|
||||
case Ci.calIFreeBusyInterval.UNKNOWN:
|
||||
block.classList.add("unknown");
|
||||
break;
|
||||
default:
|
||||
block.classList.add("busy");
|
||||
break;
|
||||
}
|
||||
setLeftAndWidth(block, result.interval.start, result.interval.end);
|
||||
}
|
||||
setLeftAndWidth(block, result.interval.start, result.interval.end);
|
||||
}
|
||||
if (!operation.isPending) {
|
||||
this.dispatchEvent(new CustomEvent("freebusy-update-finished"));
|
||||
pendingDiv.remove();
|
||||
}
|
||||
},
|
||||
});
|
||||
if (!operation.isPending) {
|
||||
this.dispatchEvent(new CustomEvent("freebusy-update-finished"));
|
||||
pendingDiv.remove();
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
this.dispatchEvent(new CustomEvent("freebusy-update-started"));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ function onLoad() {
|
|||
window.time = args.time;
|
||||
window.onAcceptCallback = args.onOk;
|
||||
|
||||
let tzProvider = args.calendar.getProperty("timezones.provider") || cal.getTimezoneService();
|
||||
let tzProvider = args.calendar.getProperty("timezones.provider") || cal.timezoneService;
|
||||
window.tzProvider = tzProvider;
|
||||
|
||||
let menulist = document.getElementById("timezone-menulist");
|
||||
|
|
|
@ -34,7 +34,7 @@ async function onWindowLoad() {
|
|||
gModel.file = window.arguments[0];
|
||||
document.getElementById("calendar-ics-file-dialog-file-path").value = gModel.file.path;
|
||||
|
||||
let calendars = cal.getCalendarManager().getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
gModel.calendars = getCalendarsThatCanImport(calendars);
|
||||
if (!gModel.calendars.length) {
|
||||
// No calendars to import into. Show error dialog and close the window.
|
||||
|
|
|
@ -194,9 +194,7 @@ function setupEnabledCheckbox() {
|
|||
* shown unless the provider for the calendar is missing (i.e force-disabled)
|
||||
*/
|
||||
document.addEventListener("dialogextra1", () => {
|
||||
let calmgr = cal.getCalendarManager();
|
||||
|
||||
calmgr.unregisterCalendar(gCalendar);
|
||||
cal.manager.unregisterCalendar(gCalendar);
|
||||
window.close();
|
||||
});
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ function onLoad() {
|
|||
|
||||
let calendarList = document.getElementById("calendar-list");
|
||||
|
||||
for (let calendar of cal.getCalendarManager().getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
if (calendar.providerID != extension.id) {
|
||||
continue;
|
||||
}
|
||||
|
@ -46,10 +46,9 @@ document.addEventListener("dialogaccept", () => {
|
|||
let calendarList = document.getElementById("calendar-list");
|
||||
|
||||
// Unsubscribe from all selected calendars
|
||||
let calMgr = cal.getCalendarManager();
|
||||
for (let item of calendarList.children) {
|
||||
if (item.querySelector(".calendar-selected").checked) {
|
||||
calMgr.unregisterCalendar(calMgr.getCalendarById(item.getAttribute("calendar-id")));
|
||||
cal.manager.unregisterCalendar(cal.manager.getCalendarById(item.getAttribute("calendar-id")));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -307,7 +307,7 @@ function exportEntireCalendar(aCalendar) {
|
|||
if (aCalendar) {
|
||||
getItemsFromCal(aCalendar);
|
||||
} else {
|
||||
let calendars = cal.getCalendarManager().getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
|
||||
if (calendars.length == 1) {
|
||||
// There's only one calendar, so it's silly to ask what calendar
|
||||
|
|
|
@ -421,7 +421,7 @@ function openEventDialog(
|
|||
// Set up some defaults
|
||||
mode = mode || "new";
|
||||
calendar = calendar || getSelectedCalendar();
|
||||
let calendars = cal.getCalendarManager().getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
calendars = calendars.filter(cal.acl.isCalendarWritable);
|
||||
|
||||
let isItemSupported;
|
||||
|
|
|
@ -3342,8 +3342,7 @@ editEndTimezone.complete = function(datetime) {
|
|||
function chooseRecentTimezone(event) {
|
||||
let tzid = event.target.value;
|
||||
let timezonePopup = document.getElementById("timezone-popup");
|
||||
let tzProvider =
|
||||
getCurrentCalendar().getProperty("timezones.provider") || cal.getTimezoneService();
|
||||
let tzProvider = getCurrentCalendar().getProperty("timezones.provider") || cal.timezoneService;
|
||||
|
||||
if (tzid != "custom") {
|
||||
let zone = tzProvider.getTimezone(tzid);
|
||||
|
|
|
@ -58,12 +58,11 @@ var gCalendarGeneralPane = {
|
|||
let tzMenuList = document.getElementById("calendar-timezone-menulist");
|
||||
let tzMenuPopup = document.getElementById("calendar-timezone-menupopup");
|
||||
|
||||
let tzService = cal.getTimezoneService();
|
||||
let tzids = {};
|
||||
let displayNames = [];
|
||||
// don't rely on what order the timezone-service gives you
|
||||
for (let timezoneId of tzService.timezoneIds) {
|
||||
let timezone = tzService.getTimezone(timezoneId);
|
||||
for (let timezoneId of cal.timezoneService.timezoneIds) {
|
||||
let timezone = cal.timezoneService.getTimezone(timezoneId);
|
||||
if (timezone && !timezone.isFloating && !timezone.isUTC) {
|
||||
let displayName = timezone.displayName;
|
||||
displayNames.push(displayName);
|
||||
|
|
|
@ -50,7 +50,7 @@ function publishCalendarDataDialogResponse(CalendarPublishObject, aProgressDialo
|
|||
*/
|
||||
function publishEntireCalendar(aCalendar) {
|
||||
if (!aCalendar) {
|
||||
let calendars = cal.getCalendarManager().getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
|
||||
if (calendars.length == 1) {
|
||||
// Do not ask user for calendar if only one calendar exists
|
||||
|
@ -157,7 +157,7 @@ function publishItemArray(aItemArray, aPath, aProgressDialog) {
|
|||
);
|
||||
serializer.addItems(aItemArray);
|
||||
// Outlook requires METHOD:PUBLISH property:
|
||||
let methodProp = cal.getIcsService().createIcalProperty("METHOD");
|
||||
let methodProp = cal.icsService.createIcalProperty("METHOD");
|
||||
methodProp.value = "PUBLISH";
|
||||
serializer.addProperty(methodProp);
|
||||
serializer.serializeToStream(outputStream);
|
||||
|
|
|
@ -402,7 +402,7 @@ var TodayPane = {
|
|||
currentweeklabel.value =
|
||||
cal.l10n.getCalString("shortcalendarweek") +
|
||||
" " +
|
||||
cal.getWeekInfoService().getWeekTitle(this.start);
|
||||
cal.weekInfoService.getWeekTitle(this.start);
|
||||
|
||||
if (!aDontUpdateMinimonth) {
|
||||
try {
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
*/
|
||||
setAttribute(aAttr, aVal) {
|
||||
if (aAttr == "dropbox") {
|
||||
let session = cal.getDragService().getCurrentSession();
|
||||
let session = cal.dragService.getCurrentSession();
|
||||
if (session) {
|
||||
session.canDrop = true;
|
||||
// no shadows when dragging in the initial position
|
||||
|
@ -131,7 +131,7 @@
|
|||
}
|
||||
|
||||
onDragOver(event) {
|
||||
let session = cal.getDragService().getCurrentSession();
|
||||
let session = cal.dragService.getCurrentSession();
|
||||
if (!session?.sourceNode?.sourceObject) {
|
||||
// No source item? Then this is not for us.
|
||||
return;
|
||||
|
@ -142,7 +142,7 @@
|
|||
}
|
||||
|
||||
onDragEnter(event) {
|
||||
let session = cal.getDragService().getCurrentSession();
|
||||
let session = cal.dragService.getCurrentSession();
|
||||
if (!session?.sourceNode?.sourceObject) {
|
||||
// No source item? Then this is not for us.
|
||||
return;
|
||||
|
@ -164,7 +164,7 @@
|
|||
}
|
||||
|
||||
onDrop(event) {
|
||||
let session = cal.getDragService().getCurrentSession();
|
||||
let session = cal.dragService.getCurrentSession();
|
||||
let item = session?.sourceNode?.sourceObject;
|
||||
if (!item) {
|
||||
// No source node? Not our drag.
|
||||
|
|
|
@ -1109,9 +1109,9 @@ let CalendarFilteredViewMixin = Base =>
|
|||
this.#filter.itemType = value;
|
||||
this.#calendarObserver.self = this;
|
||||
if (value) {
|
||||
cal.getCalendarManager().addCalendarObserver(this.#calendarObserver);
|
||||
cal.manager.addCalendarObserver(this.#calendarObserver);
|
||||
} else {
|
||||
cal.getCalendarManager().removeCalendarObserver(this.#calendarObserver);
|
||||
cal.manager.removeCalendarObserver(this.#calendarObserver);
|
||||
}
|
||||
|
||||
this.#invalidate();
|
||||
|
@ -1140,7 +1140,7 @@ let CalendarFilteredViewMixin = Base =>
|
|||
// Collect items from all of the calendars.
|
||||
this.clearItems();
|
||||
let promises = [];
|
||||
for (let calendar of cal.getCalendarManager().getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
promises.push(this.#refreshCalendar(calendar));
|
||||
}
|
||||
|
||||
|
|
|
@ -645,9 +645,9 @@
|
|||
let firstElement = this._getCalBoxNode(k, 0);
|
||||
firstElement.hidden = !this.showWeekNumber;
|
||||
if (this.showWeekNumber) {
|
||||
let weekNumber = cal
|
||||
.getWeekInfoService()
|
||||
.getWeekTitle(cal.dtz.jsDateToDateTime(date, defaultTz));
|
||||
let weekNumber = cal.weekInfoService.getWeekTitle(
|
||||
cal.dtz.jsDateToDateTime(date, defaultTz)
|
||||
);
|
||||
let weekTitle = cal.l10n.getCalString("WeekTitle", [weekNumber]);
|
||||
firstElement.textContent = weekNumber;
|
||||
firstElement.setAttribute("aria-label", weekTitle);
|
||||
|
|
|
@ -30,10 +30,9 @@ var calendarDeactivator = {
|
|||
QueryInterface: ChromeUtils.generateQI(["calICalendarManagerObserver", "calIObserver"]),
|
||||
|
||||
initializeDeactivator() {
|
||||
let manager = cal.getCalendarManager();
|
||||
this.calendars = new Set(manager.getCalendars());
|
||||
manager.addObserver(this);
|
||||
manager.addCalendarObserver(this);
|
||||
this.calendars = new Set(cal.manager.getCalendars());
|
||||
cal.manager.addObserver(this);
|
||||
cal.manager.addCalendarObserver(this);
|
||||
this.isCalendarActivated = this.checkCalendarsEnabled();
|
||||
},
|
||||
|
||||
|
|
|
@ -18,11 +18,6 @@ var gCalendarConsole = new ConsoleAPI({
|
|||
maxLogLevel: Services.prefs.getBoolPref("calendar.debug.log", false) ? "all" : "warn",
|
||||
});
|
||||
|
||||
// Cache services to avoid calling getService over and over again. The cache is
|
||||
// a separate object to avoid polluting `cal`, and is defined here since a call
|
||||
// to `_service` will require it to already exist.
|
||||
var gServiceCache = {};
|
||||
|
||||
const EXPORTED_SYMBOLS = ["cal"];
|
||||
var cal = {
|
||||
// These functions exist to reduce boilerplate code for creating instances
|
||||
|
@ -40,13 +35,6 @@ var cal = {
|
|||
"icalString"
|
||||
),
|
||||
|
||||
getCalendarManager: _service("@mozilla.org/calendar/manager;1", "calICalendarManager"),
|
||||
getIcsService: _service("@mozilla.org/calendar/ics-service;1", "calIICSService"),
|
||||
getTimezoneService: _service("@mozilla.org/calendar/timezone-service;1", "calITimezoneService"),
|
||||
getFreeBusyService: _service("@mozilla.org/calendar/freebusy-service;1", "calIFreeBusyService"),
|
||||
getWeekInfoService: _service("@mozilla.org/calendar/weekinfo-service;1", "calIWeekInfoService"),
|
||||
getDragService: _service("@mozilla.org/widget/dragservice;1", "nsIDragService"),
|
||||
|
||||
/**
|
||||
* The calendar console instance
|
||||
*/
|
||||
|
@ -391,6 +379,44 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
false
|
||||
);
|
||||
|
||||
// Services
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
cal,
|
||||
"manager",
|
||||
"@mozilla.org/calendar/manager;1",
|
||||
"calICalendarManager"
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
cal,
|
||||
"icsService",
|
||||
"@mozilla.org/calendar/ics-service;1",
|
||||
"calIICSService"
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
cal,
|
||||
"timezoneService",
|
||||
"@mozilla.org/calendar/timezone-service;1",
|
||||
"calITimezoneService"
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
cal,
|
||||
"freeBusyService",
|
||||
"@mozilla.org/calendar/freebusy-service;1",
|
||||
"calIFreeBusyService"
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
cal,
|
||||
"weekInfoService",
|
||||
"@mozilla.org/calendar/weekinfo-service;1",
|
||||
"calIWeekInfoService"
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
cal,
|
||||
"dragService",
|
||||
"@mozilla.org/widget/dragservice;1",
|
||||
"nsIDragService"
|
||||
);
|
||||
|
||||
// Sub-modules for calUtils
|
||||
XPCOMUtils.defineLazyModuleGetter(
|
||||
cal,
|
||||
|
@ -507,21 +533,6 @@ XPCOMUtils.defineLazyModuleGetter(
|
|||
"calxml"
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns a function that provides access to the given service.
|
||||
*
|
||||
* @param cid The contract id to create
|
||||
* @param iid The interface id to create with
|
||||
* @return {function} A function that returns the given service
|
||||
*/
|
||||
function _service(cid, iid) {
|
||||
let name = `_${iid}`;
|
||||
XPCOMUtils.defineLazyServiceGetter(gServiceCache, name, cid, iid);
|
||||
return function() {
|
||||
return gServiceCache[name];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a function that creates an instance of the given component and
|
||||
* optionally initializes it using the property name passed.
|
||||
|
|
|
@ -20,21 +20,21 @@ var caldtz = {
|
|||
* Shortcut to the timezone service's defaultTimezone
|
||||
*/
|
||||
get defaultTimezone() {
|
||||
return cal.getTimezoneService().defaultTimezone;
|
||||
return cal.timezoneService.defaultTimezone;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shorcut to the UTC timezone
|
||||
*/
|
||||
get UTC() {
|
||||
return cal.getTimezoneService().UTC;
|
||||
return cal.timezoneService.UTC;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shortcut to the floating (local) timezone
|
||||
*/
|
||||
get floating() {
|
||||
return cal.getTimezoneService().floating;
|
||||
return cal.timezoneService.floating;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -279,10 +279,9 @@ var caldtz = {
|
|||
if (dateTime.timezoneOffset != offset_in_s) {
|
||||
// TODO A patch to Bug 363191 should make this more efficient.
|
||||
|
||||
let tzService = cal.getTimezoneService();
|
||||
// Enumerate timezones, set them, check their offset
|
||||
for (let id of tzService.timezoneIds) {
|
||||
dateTime.timezone = tzService.getTimezone(id);
|
||||
for (let id of cal.timezoneService.timezoneIds) {
|
||||
dateTime.timezone = cal.timezoneService.getTimezone(id);
|
||||
if (dateTime.timezoneOffset == offset_in_s) {
|
||||
// This is our last step, so go ahead and return
|
||||
return dateTime;
|
||||
|
@ -364,11 +363,10 @@ var caldtz = {
|
|||
recentTimezones = [];
|
||||
}
|
||||
|
||||
let tzService = cal.getTimezoneService();
|
||||
if (aConvertZones) {
|
||||
let oldZonesLength = recentTimezones.length;
|
||||
for (let i = 0; i < recentTimezones.length; i++) {
|
||||
let timezone = tzService.getTimezone(recentTimezones[i]);
|
||||
let timezone = cal.timezoneService.getTimezone(recentTimezones[i]);
|
||||
if (timezone) {
|
||||
// Replace id with found timezone
|
||||
recentTimezones[i] = timezone;
|
||||
|
|
|
@ -226,10 +226,7 @@ var calitip = {
|
|||
);
|
||||
};
|
||||
|
||||
let writableCalendars = cal
|
||||
.getCalendarManager()
|
||||
.getCalendars()
|
||||
.filter(isWritableCalendar);
|
||||
let writableCalendars = cal.manager.getCalendars().filter(isWritableCalendar);
|
||||
if (writableCalendars.length > 0) {
|
||||
let compCal = Cc["@mozilla.org/calendar/calendar;1?type=composite"].createInstance(
|
||||
Ci.calICompositeCalendar
|
||||
|
@ -630,10 +627,7 @@ var calitip = {
|
|||
}
|
||||
|
||||
if (needsCalendar) {
|
||||
let calendars = cal
|
||||
.getCalendarManager()
|
||||
.getCalendars()
|
||||
.filter(calitip.isSchedulingCalendar);
|
||||
let calendars = cal.manager.getCalendars().filter(calitip.isSchedulingCalendar);
|
||||
|
||||
if (aItipItem.receivedMethod == "REQUEST") {
|
||||
// try to further limit down the list to those calendars that
|
||||
|
|
|
@ -21,8 +21,6 @@ ChromeUtils.defineModuleGetter(this, "cal", "resource:///modules/calendar/calUti
|
|||
|
||||
const EXPORTED_SYMBOLS = ["calprint"]; /* exported calprint */
|
||||
|
||||
const weekInfoService = cal.getWeekInfoService();
|
||||
|
||||
var calprint = {
|
||||
ensureInitialized() {
|
||||
// Deliberate no-op. By calling this function from outside, you've ensured
|
||||
|
@ -340,11 +338,11 @@ let monthGridView = {
|
|||
} while (current.compare(endDate) < 0);
|
||||
|
||||
// Extend the date range to include adjacent days that will be printed.
|
||||
startDate = weekInfoService.getStartOfWeek(startDate);
|
||||
startDate = cal.weekInfoService.getStartOfWeek(startDate);
|
||||
// Get the end of the week containing the last day of the month, not the
|
||||
// week containing the first day of the next month.
|
||||
endDate.day--;
|
||||
endDate = weekInfoService.getEndOfWeek(endDate);
|
||||
endDate = cal.weekInfoService.getEndOfWeek(endDate);
|
||||
endDate.day++; // Add a day to include items from the last day.
|
||||
|
||||
// Get and display the items.
|
||||
|
@ -410,8 +408,8 @@ let monthGridView = {
|
|||
}
|
||||
|
||||
// Set up each week
|
||||
let endOfMonthView = weekInfoService.getEndOfWeek(startOfMonth.endOfMonth);
|
||||
let startOfMonthView = weekInfoService.getStartOfWeek(startOfMonth);
|
||||
let endOfMonthView = cal.weekInfoService.getEndOfWeek(startOfMonth.endOfMonth);
|
||||
let startOfMonthView = cal.weekInfoService.getStartOfWeek(startOfMonth);
|
||||
let mainMonth = startOfMonth.month;
|
||||
|
||||
for (
|
||||
|
@ -557,7 +555,7 @@ let weekPlannerView = {
|
|||
let week = weekTemplate.content.firstElementChild.cloneNode(true);
|
||||
|
||||
// Set up the week number title
|
||||
week.number = weekInfoService.getWeekTitle(monday);
|
||||
week.number = cal.weekInfoService.getWeekTitle(monday);
|
||||
week.querySelector(".week-title").textContent = cal.l10n.getCalString("WeekTitle", [
|
||||
week.number,
|
||||
]);
|
||||
|
|
|
@ -459,14 +459,12 @@ var calprovider = {
|
|||
}
|
||||
this.mID = aValue;
|
||||
|
||||
let calMgr = cal.getCalendarManager();
|
||||
|
||||
// make all properties persistent that have been set so far:
|
||||
for (let aName in this.mProperties) {
|
||||
if (!this.constructor.mTransientProperties[aName]) {
|
||||
let value = this.mProperties[aName];
|
||||
if (value !== null) {
|
||||
calMgr.setCalendarPref_(this, aName, value);
|
||||
cal.manager.setCalendarPref_(this, aName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -679,7 +677,7 @@ var calprovider = {
|
|||
!this.transientProperties
|
||||
) {
|
||||
if (this.id) {
|
||||
ret = cal.getCalendarManager().getCalendarPref_(this, aName);
|
||||
ret = cal.manager.getCalendarPref_(this, aName);
|
||||
}
|
||||
switch (aName) {
|
||||
case "suppressAlarms":
|
||||
|
@ -710,7 +708,7 @@ var calprovider = {
|
|||
break;
|
||||
}
|
||||
if (!this.transientProperties && !this.constructor.mTransientProperties[aName] && this.id) {
|
||||
cal.getCalendarManager().setCalendarPref_(this, aName, aValue);
|
||||
cal.manager.setCalendarPref_(this, aName, aValue);
|
||||
}
|
||||
this.mObservers.notify("onPropertyChanged", [this.superCalendar, aName, aValue, oldValue]);
|
||||
}
|
||||
|
@ -721,7 +719,7 @@ var calprovider = {
|
|||
deleteProperty(aName) {
|
||||
this.mObservers.notify("onPropertyDeleting", [this.superCalendar, aName]);
|
||||
delete this.mProperties[aName];
|
||||
cal.getCalendarManager().deleteCalendarPref_(this, aName);
|
||||
cal.manager.deleteCalendarPref_(this, aName);
|
||||
}
|
||||
|
||||
// calIOperation refresh
|
||||
|
|
|
@ -172,9 +172,8 @@ var calview = {
|
|||
},
|
||||
onCalendarDeleting(calendar) {},
|
||||
};
|
||||
const calManager = cal.getCalendarManager();
|
||||
calManager.addObserver(calManagerObserver);
|
||||
aWindow.addEventListener("unload", () => calManager.removeObserver(calManagerObserver));
|
||||
cal.manager.addObserver(calManagerObserver);
|
||||
aWindow.addEventListener("unload", () => cal.manager.removeObserver(calManagerObserver));
|
||||
|
||||
comp.prefPrefix = prefix; // populate calendar from existing calendars
|
||||
|
||||
|
@ -442,10 +441,9 @@ calview.colorTracker = {
|
|||
// Deregistration is not required.
|
||||
registerWindow(aWindow) {
|
||||
if (this.calendars === null) {
|
||||
let manager = cal.getCalendarManager();
|
||||
this.calendars = new Set(manager.getCalendars());
|
||||
manager.addObserver(this);
|
||||
manager.addCalendarObserver(this);
|
||||
this.calendars = new Set(cal.manager.getCalendars());
|
||||
cal.manager.addObserver(this);
|
||||
cal.manager.addCalendarObserver(this);
|
||||
|
||||
this.categoryBranch = Services.prefs.getBranch("calendar.category.color.");
|
||||
this.categoryBranch.addObserver("", this);
|
||||
|
|
|
@ -352,7 +352,7 @@ CalAlarm.prototype = {
|
|||
},
|
||||
set icalString(val) {
|
||||
this.ensureMutable();
|
||||
this.icalComponent = cal.getIcsService().parseICS(val, null);
|
||||
this.icalComponent = cal.icsService.parseICS(val, null);
|
||||
},
|
||||
|
||||
promotedProps: {
|
||||
|
@ -370,16 +370,15 @@ CalAlarm.prototype = {
|
|||
},
|
||||
|
||||
get icalComponent() {
|
||||
let icssvc = cal.getIcsService();
|
||||
let comp = icssvc.createIcalComponent("VALARM");
|
||||
let comp = cal.icsService.createIcalComponent("VALARM");
|
||||
|
||||
// Set up action (REQUIRED)
|
||||
let actionProp = icssvc.createIcalProperty("ACTION");
|
||||
let actionProp = cal.icsService.createIcalProperty("ACTION");
|
||||
actionProp.value = this.action;
|
||||
comp.addProperty(actionProp);
|
||||
|
||||
// Set up trigger (REQUIRED)
|
||||
let triggerProp = icssvc.createIcalProperty("TRIGGER");
|
||||
let triggerProp = cal.icsService.createIcalProperty("TRIGGER");
|
||||
if (this.related == ALARM_RELATED_ABSOLUTE && this.mAbsoluteDate) {
|
||||
// Set the trigger to a specific datetime
|
||||
triggerProp.setParameter("VALUE", "DATE-TIME");
|
||||
|
@ -399,8 +398,8 @@ CalAlarm.prototype = {
|
|||
// Set up repeat and duration (OPTIONAL, but if one exists, the other
|
||||
// MUST also exist)
|
||||
if (this.repeat && this.repeatOffset) {
|
||||
let repeatProp = icssvc.createIcalProperty("REPEAT");
|
||||
let durationProp = icssvc.createIcalProperty("DURATION");
|
||||
let repeatProp = cal.icsService.createIcalProperty("REPEAT");
|
||||
let durationProp = cal.icsService.createIcalProperty("DURATION");
|
||||
|
||||
repeatProp.value = this.repeat;
|
||||
durationProp.valueAsIcalString = this.repeatOffset.icalString;
|
||||
|
@ -429,7 +428,7 @@ CalAlarm.prototype = {
|
|||
|
||||
// Set up summary (REQUIRED for EMAIL)
|
||||
if (this.summary || this.action == "EMAIL") {
|
||||
let summaryProp = icssvc.createIcalProperty("SUMMARY");
|
||||
let summaryProp = cal.icsService.createIcalProperty("SUMMARY");
|
||||
// Summary needs to have a non-empty value
|
||||
summaryProp.value = this.summary || cal.l10n.getCalString("alarmDefaultSummary");
|
||||
comp.addProperty(summaryProp);
|
||||
|
@ -437,7 +436,7 @@ CalAlarm.prototype = {
|
|||
|
||||
// Set up the description (REQUIRED for DISPLAY and EMAIL)
|
||||
if (this.description || this.action == "DISPLAY" || this.action == "EMAIL") {
|
||||
let descriptionProp = icssvc.createIcalProperty("DESCRIPTION");
|
||||
let descriptionProp = cal.icsService.createIcalProperty("DESCRIPTION");
|
||||
// description needs to have a non-empty value
|
||||
descriptionProp.value = this.description || cal.l10n.getCalString("alarmDefaultDescription");
|
||||
comp.addProperty(descriptionProp);
|
||||
|
@ -445,7 +444,7 @@ CalAlarm.prototype = {
|
|||
|
||||
// Set up lastAck
|
||||
if (this.lastAck) {
|
||||
let lastAckProp = icssvc.createIcalProperty("X-MOZ-LASTACK");
|
||||
let lastAckProp = cal.icsService.createIcalProperty("X-MOZ-LASTACK");
|
||||
lastAckProp.value = this.lastAck;
|
||||
comp.addProperty(lastAckProp);
|
||||
}
|
||||
|
@ -453,7 +452,7 @@ CalAlarm.prototype = {
|
|||
// Set up X-Props. mProperties contains only non-promoted props
|
||||
// eslint-disable-next-line array-bracket-spacing
|
||||
for (let [propName, propValue] of this.mProperties.entries()) {
|
||||
let icalprop = icssvc.createIcalProperty(propName);
|
||||
let icalprop = cal.icsService.createIcalProperty(propName);
|
||||
icalprop.value = propValue;
|
||||
|
||||
// Add parameters
|
||||
|
|
|
@ -83,7 +83,7 @@ function CalAlarmService() {
|
|||
"gNotificationsTimes",
|
||||
"calendar.notifications.times",
|
||||
"",
|
||||
() => this.initAlarms(cal.getCalendarManager().getCalendars())
|
||||
() => this.initAlarms(cal.manager.getCalendars())
|
||||
);
|
||||
|
||||
this.calendarObserver = {
|
||||
|
@ -320,9 +320,9 @@ CalAlarmService.prototype = {
|
|||
// Tell people that we're alive so they can start monitoring alarms.
|
||||
Services.obs.notifyObservers(null, "alarm-service-startup");
|
||||
|
||||
cal.getCalendarManager().addObserver(this.calendarManagerObserver);
|
||||
cal.manager.addObserver(this.calendarManagerObserver);
|
||||
|
||||
for (let calendar of cal.getCalendarManager().getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
this.observeCalendar(calendar);
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ CalAlarmService.prototype = {
|
|||
end.hour += kHoursBetweenUpdates;
|
||||
this.alarmService.mRangeEnd = end.getInTimezone(cal.dtz.UTC);
|
||||
|
||||
this.alarmService.findAlarms(cal.getCalendarManager().getCalendars(), start, until);
|
||||
this.alarmService.findAlarms(cal.manager.getCalendars(), start, until);
|
||||
},
|
||||
};
|
||||
timerCallback.notify();
|
||||
|
@ -375,11 +375,10 @@ CalAlarmService.prototype = {
|
|||
this.mUpdateTimer = null;
|
||||
}
|
||||
|
||||
let calmgr = cal.getCalendarManager();
|
||||
calmgr.removeObserver(this.calendarManagerObserver);
|
||||
cal.manager.removeObserver(this.calendarManagerObserver);
|
||||
|
||||
// Stop observing all calendars. This will also clear the timers.
|
||||
for (let calendar of calmgr.getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
this.unobserveCalendar(calendar);
|
||||
}
|
||||
|
||||
|
@ -806,10 +805,7 @@ CalAlarmService.prototype = {
|
|||
// we need to exclude calendars which failed to load explicitly to
|
||||
// prevent the alaram dialog to stay opened after dismissing all
|
||||
// alarms if there is a network calendar that failed to load
|
||||
let currentStatus = cal
|
||||
.getCalendarManager()
|
||||
.getCalendarById(calId)
|
||||
.getProperty("currentStatus");
|
||||
let currentStatus = cal.manager.getCalendarById(calId).getProperty("currentStatus");
|
||||
if (!this.mLoadedCalendars[calId] && Components.isSuccessCode(currentStatus)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ CalAttachment.prototype = {
|
|||
},
|
||||
|
||||
get icalProperty() {
|
||||
let icalatt = cal.getIcsService().createIcalProperty("ATTACH");
|
||||
let icalatt = cal.icsService.createIcalProperty("ATTACH");
|
||||
|
||||
for (let [key, value] of this.mProperties.entries()) {
|
||||
try {
|
||||
|
@ -135,7 +135,7 @@ CalAttachment.prototype = {
|
|||
return comp ? comp.icalString : "";
|
||||
},
|
||||
set icalString(val) {
|
||||
let prop = cal.getIcsService().createIcalPropertyFromString(val);
|
||||
let prop = cal.icsService.createIcalPropertyFromString(val);
|
||||
if (prop.propertyName != "ATTACH") {
|
||||
throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
}
|
||||
|
|
|
@ -106,12 +106,11 @@ CalAttendee.prototype = {
|
|||
},
|
||||
|
||||
get icalProperty() {
|
||||
let icssvc = cal.getIcsService();
|
||||
let icalatt;
|
||||
if (this.mIsOrganizer) {
|
||||
icalatt = icssvc.createIcalProperty("ORGANIZER");
|
||||
icalatt = cal.icsService.createIcalProperty("ORGANIZER");
|
||||
} else {
|
||||
icalatt = icssvc.createIcalProperty("ATTENDEE");
|
||||
icalatt = cal.icsService.createIcalProperty("ATTENDEE");
|
||||
}
|
||||
|
||||
if (!this.id) {
|
||||
|
@ -155,7 +154,7 @@ CalAttendee.prototype = {
|
|||
return comp ? comp.icalString : "";
|
||||
},
|
||||
set icalString(val) {
|
||||
let prop = cal.getIcsService().createIcalPropertyFromString(val);
|
||||
let prop = cal.icsService.createIcalPropertyFromString(val);
|
||||
if (prop.propertyName != "ORGANIZER" && prop.propertyName != "ATTENDEE") {
|
||||
throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
}
|
||||
|
|
|
@ -973,8 +973,7 @@ var gCalendarManagerAddonListener = {
|
|||
queryUninstallProvider(aAddon) {
|
||||
const uri = "chrome://calendar/content/calendar-providerUninstall-dialog.xhtml";
|
||||
const features = "chrome,titlebar,resizable,modal";
|
||||
let calMgr = cal.getCalendarManager();
|
||||
let affectedCalendars = calMgr
|
||||
let affectedCalendars = cal.manager
|
||||
.getCalendars()
|
||||
.filter(calendar => calendar.providerID == aAddon.id);
|
||||
if (!affectedCalendars.length) {
|
||||
|
|
|
@ -123,7 +123,7 @@ CalDeletedItems.prototype = {
|
|||
if (aTopic == "profile-after-change") {
|
||||
// Make sure to observe calendar changes so we know when things are
|
||||
// deleted. We don't initialize the statements until first use.
|
||||
cal.getCalendarManager().addCalendarObserver(this);
|
||||
cal.manager.addCalendarObserver(this);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -176,7 +176,7 @@ CalDeletedItems.prototype = {
|
|||
cal.ERROR("Error closing deleted items database: " + e);
|
||||
}
|
||||
|
||||
cal.getCalendarManager().removeCalendarObserver(this);
|
||||
cal.manager.removeCalendarObserver(this);
|
||||
},
|
||||
|
||||
// calIObserver
|
||||
|
|
|
@ -95,19 +95,18 @@ CalEvent.prototype = {
|
|||
],
|
||||
|
||||
set icalString(value) {
|
||||
this.icalComponent = cal.getIcsService().parseICS(value, null);
|
||||
this.icalComponent = cal.icsService.parseICS(value, null);
|
||||
},
|
||||
|
||||
get icalString() {
|
||||
let calcomp = cal.getIcsService().createIcalComponent("VCALENDAR");
|
||||
let calcomp = cal.icsService.createIcalComponent("VCALENDAR");
|
||||
cal.item.setStaticProps(calcomp);
|
||||
calcomp.addSubcomponent(this.icalComponent);
|
||||
return calcomp.serializeToICS();
|
||||
},
|
||||
|
||||
get icalComponent() {
|
||||
let icssvc = cal.getIcsService();
|
||||
let icalcomp = icssvc.createIcalComponent("VEVENT");
|
||||
let icalcomp = cal.icsService.createIcalComponent("VEVENT");
|
||||
this.fillIcalComponentFromBase(icalcomp);
|
||||
this.mapPropsToICS(icalcomp, this.icsEventPropMap);
|
||||
|
||||
|
@ -117,7 +116,7 @@ CalEvent.prototype = {
|
|||
// but instead set to null, so we need to prevent adding those properties.
|
||||
let wasReset = this.mIsProxy && value === null;
|
||||
if (!this.eventPromotedProps[name] && !wasReset) {
|
||||
let icalprop = icssvc.createIcalProperty(name);
|
||||
let icalprop = cal.icsService.createIcalProperty(name);
|
||||
icalprop.value = value;
|
||||
let propBucket = this.mPropertyParams[name];
|
||||
if (propBucket) {
|
||||
|
|
|
@ -138,7 +138,7 @@ CalIcsParser.prototype = {
|
|||
// parser containing the processed items.
|
||||
// The listener passed to parseICSAsync is a calICsComponentParsingListener
|
||||
// required by the ics service, that receives the parsed root component.
|
||||
cal.getIcsService().parseICSAsync(aICSString, aTzProvider, {
|
||||
cal.icsService.parseICSAsync(aICSString, aTzProvider, {
|
||||
onParsingComplete(rc, rootComp) {
|
||||
if (Components.isSuccessCode(rc)) {
|
||||
self.processIcalComponent(rootComp, aAsyncParsing);
|
||||
|
@ -150,7 +150,7 @@ CalIcsParser.prototype = {
|
|||
});
|
||||
} else {
|
||||
try {
|
||||
let icalComp = cal.getIcsService().parseICS(aICSString, aTzProvider);
|
||||
let icalComp = cal.icsService.parseICS(aICSString, aTzProvider);
|
||||
// There is no such indicator like X-LIC in icaljs, so there would need to
|
||||
// detect and log such errors already within the parser. However, until
|
||||
// X-LIC or libical will be removed we make use of X-LIC-ERRORS here but
|
||||
|
|
|
@ -55,7 +55,7 @@ CalIcsSerializer.prototype = {
|
|||
},
|
||||
|
||||
getIcalComponent() {
|
||||
let calComp = cal.getIcsService().createIcalComponent("VCALENDAR");
|
||||
let calComp = cal.icsService.createIcalComponent("VCALENDAR");
|
||||
cal.item.setStaticProps(calComp);
|
||||
|
||||
// xxx todo: think about that the below code doesn't clone the properties/components,
|
||||
|
|
|
@ -87,7 +87,7 @@ CalRecurrenceDate.prototype = {
|
|||
return comp ? comp.icalString : "";
|
||||
},
|
||||
set icalString(val) {
|
||||
let prop = cal.getIcsService().createIcalPropertyFromString(val);
|
||||
let prop = cal.icsService.createIcalPropertyFromString(val);
|
||||
let propName = prop.propertyName;
|
||||
if (propName != "RDATE" && propName != "EXDATE") {
|
||||
throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
|
@ -97,7 +97,7 @@ CalRecurrenceDate.prototype = {
|
|||
},
|
||||
|
||||
get icalProperty() {
|
||||
let prop = cal.getIcsService().createIcalProperty(this.mIsNegative ? "EXDATE" : "RDATE");
|
||||
let prop = cal.icsService.createIcalProperty(this.mIsNegative ? "EXDATE" : "RDATE");
|
||||
prop.valueAsDatetime = this.mDate;
|
||||
return prop;
|
||||
},
|
||||
|
|
|
@ -46,8 +46,7 @@ CalRelation.prototype = {
|
|||
},
|
||||
|
||||
get icalProperty() {
|
||||
let icssvc = cal.getIcsService();
|
||||
let icalatt = icssvc.createIcalProperty("RELATED-TO");
|
||||
let icalatt = cal.icsService.createIcalProperty("RELATED-TO");
|
||||
if (this.mId) {
|
||||
icalatt.value = this.mId;
|
||||
}
|
||||
|
@ -95,7 +94,7 @@ CalRelation.prototype = {
|
|||
return comp ? comp.icalString : "";
|
||||
},
|
||||
set icalString(val) {
|
||||
let prop = cal.getIcsService().createIcalPropertyFromString(val);
|
||||
let prop = cal.icsService.createIcalPropertyFromString(val);
|
||||
if (prop.propertyName != "RELATED-TO") {
|
||||
throw Components.Exception("", Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
}
|
||||
|
|
|
@ -136,19 +136,18 @@ CalTodo.prototype = {
|
|||
],
|
||||
|
||||
set icalString(value) {
|
||||
this.icalComponent = cal.getIcsService().parseICS(value, null);
|
||||
this.icalComponent = cal.icsService.parseICS(value, null);
|
||||
},
|
||||
|
||||
get icalString() {
|
||||
let calcomp = cal.getIcsService().createIcalComponent("VCALENDAR");
|
||||
let calcomp = cal.icsService.createIcalComponent("VCALENDAR");
|
||||
cal.item.setStaticProps(calcomp);
|
||||
calcomp.addSubcomponent(this.icalComponent);
|
||||
return calcomp.serializeToICS();
|
||||
},
|
||||
|
||||
get icalComponent() {
|
||||
let icssvc = cal.getIcsService();
|
||||
let icalcomp = icssvc.createIcalComponent("VTODO");
|
||||
let icalcomp = cal.icsService.createIcalComponent("VTODO");
|
||||
this.fillIcalComponentFromBase(icalcomp);
|
||||
this.mapPropsToICS(icalcomp, this.icsEventPropMap);
|
||||
|
||||
|
@ -158,7 +157,7 @@ CalTodo.prototype = {
|
|||
// but instead set to null, so we need to prevent adding those properties.
|
||||
let wasReset = this.mIsProxy && value === null;
|
||||
if (!this.todoPromotedProps[name] && !wasReset) {
|
||||
let icalprop = icssvc.createIcalProperty(name);
|
||||
let icalprop = cal.icsService.createIcalProperty(name);
|
||||
icalprop.value = value;
|
||||
let propBucket = this.mPropertyParams[name];
|
||||
if (propBucket) {
|
||||
|
|
|
@ -1021,7 +1021,6 @@ calItemBase.prototype = {
|
|||
*/
|
||||
fillIcalComponentFromBase(icalcomp) {
|
||||
this.ensureNotDirty();
|
||||
let icssvc = cal.getIcsService();
|
||||
|
||||
this.mapPropsToICS(icalcomp, this.icsBasePropMap);
|
||||
|
||||
|
@ -1049,7 +1048,7 @@ calItemBase.prototype = {
|
|||
}
|
||||
|
||||
for (let cat of this.getCategories()) {
|
||||
let catprop = icssvc.createIcalProperty("CATEGORIES");
|
||||
let catprop = cal.icsService.createIcalProperty("CATEGORIES");
|
||||
catprop.value = cat;
|
||||
icalcomp.addProperty(catprop);
|
||||
}
|
||||
|
@ -1062,7 +1061,7 @@ calItemBase.prototype = {
|
|||
|
||||
let alarmLastAck = this.alarmLastAck;
|
||||
if (alarmLastAck) {
|
||||
let lastAck = cal.getIcsService().createIcalProperty("X-MOZ-LASTACK");
|
||||
let lastAck = cal.icsService.createIcalProperty("X-MOZ-LASTACK");
|
||||
// - should we further ensure that those are UTC or rely on calAlarmService doing so?
|
||||
lastAck.value = alarmLastAck.icalString;
|
||||
icalcomp.addProperty(lastAck);
|
||||
|
|
|
@ -17,13 +17,13 @@ calICALJSTimezone.prototype = {
|
|||
innerObject: null,
|
||||
|
||||
get provider() {
|
||||
return cal.getTimezoneService();
|
||||
return cal.timezoneService;
|
||||
},
|
||||
get icalComponent() {
|
||||
let innerComp = this.innerObject.component;
|
||||
let comp = null;
|
||||
if (innerComp) {
|
||||
comp = cal.getIcsService().createIcalComponent("VTIMEZONE");
|
||||
comp = cal.icsService.createIcalComponent("VTIMEZONE");
|
||||
comp.icalComponent = innerComp;
|
||||
}
|
||||
return comp;
|
||||
|
@ -87,8 +87,7 @@ calLibicalTimezone.prototype = {
|
|||
get icalComponent() {
|
||||
let comp = this.mComponent;
|
||||
if (comp && typeof comp == "string") {
|
||||
this.mComponent = cal
|
||||
.getIcsService()
|
||||
this.mComponent = cal.icsService
|
||||
.parseICS("BEGIN:VCALENDAR\r\n" + comp + "\r\nEND:VCALENDAR\r\n", null)
|
||||
.getFirstSubcomponent("VTIMEZONE");
|
||||
}
|
||||
|
@ -98,7 +97,7 @@ calLibicalTimezone.prototype = {
|
|||
get displayName() {
|
||||
if (this.mDisplayName === undefined) {
|
||||
try {
|
||||
let bundle = cal.getTimezoneService().wrappedJSObject.stringBundle;
|
||||
let bundle = cal.timezoneService.wrappedJSObject.stringBundle;
|
||||
this.mDisplayName = bundle.GetStringFromName(
|
||||
"pref.timezone." + this.tzid.replace(/\//g, ".")
|
||||
);
|
||||
|
@ -112,6 +111,6 @@ calLibicalTimezone.prototype = {
|
|||
},
|
||||
|
||||
get provider() {
|
||||
return cal.getTimezoneService();
|
||||
return cal.timezoneService;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -295,7 +295,7 @@ class CalItipEmailTransport {
|
|||
Ci.calIIcsSerializer
|
||||
);
|
||||
serializer.addItems(itemList);
|
||||
let methodProp = cal.getIcsService().createIcalProperty("METHOD");
|
||||
let methodProp = cal.icsService.createIcalProperty("METHOD");
|
||||
methodProp.value = aItipItem.responseMethod;
|
||||
serializer.addProperty(methodProp);
|
||||
let calText = serializer.serializeToString();
|
||||
|
|
|
@ -104,8 +104,7 @@ ItipContentHandler.prototype = {
|
|||
event.id +
|
||||
")\n"
|
||||
);
|
||||
let calMgr = cal.getCalendarManager();
|
||||
let cals = calMgr.getCalendars();
|
||||
let cals = cal.manager.getCalendars();
|
||||
cals[0].addItem(event, null);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -294,7 +294,7 @@ CalDavCalendar.prototype = {
|
|||
this.restoreCalendarProperties(itemData);
|
||||
this.setProperty("currentStatus", Cr.NS_OK);
|
||||
if (this.mHaveScheduling || this.hasAutoScheduling || this.hasFreeBusy) {
|
||||
cal.getFreeBusyService().addProvider(this);
|
||||
cal.freeBusyService.addProvider(this);
|
||||
}
|
||||
} else {
|
||||
let itemDataArray = itemData.split("\u001A");
|
||||
|
@ -1329,7 +1329,7 @@ CalDavCalendar.prototype = {
|
|||
},
|
||||
|
||||
firstInRealm() {
|
||||
let calendars = cal.getCalendarManager().getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
for (let i = 0; i < calendars.length; i++) {
|
||||
if (calendars[i].type != "caldav" || calendars[i].getProperty("disabled")) {
|
||||
continue;
|
||||
|
@ -1722,7 +1722,7 @@ CalDavCalendar.prototype = {
|
|||
// This may have already been set by fetchCachedMetaData, we only want to add
|
||||
// the freebusy provider once.
|
||||
this.hasFreeBusy = true;
|
||||
cal.getFreeBusyService().addProvider(this);
|
||||
cal.freeBusyService.addProvider(this);
|
||||
}
|
||||
this.findPrincipalNS(aChangeLogListener);
|
||||
} else {
|
||||
|
|
|
@ -412,8 +412,7 @@ class CalDavDetector {
|
|||
// Some servers provide colors as an 8-character hex string. Strip the alpha component.
|
||||
color = color?.replace(/^(#[0-9A-Fa-f]{6})[0-9A-Fa-f]{2}$/, "$1");
|
||||
|
||||
let calMgr = cal.getCalendarManager();
|
||||
let calendar = calMgr.createCalendar("caldav", uri);
|
||||
let calendar = cal.manager.createCalendar("caldav", uri);
|
||||
calendar.setProperty("color", color || cal.view.hashColor(uri.spec));
|
||||
calendar.name = displayName;
|
||||
calendar.id = cal.getUUID();
|
||||
|
|
|
@ -973,7 +973,7 @@ class CalDavOutboxRequest extends CalDavRequestBase {
|
|||
);
|
||||
serializer.addItems([aItem], 1);
|
||||
|
||||
let method = cal.getIcsService().createIcalProperty("METHOD");
|
||||
let method = cal.icsService.createIcalProperty("METHOD");
|
||||
method.value = aResponseMethod;
|
||||
serializer.addProperty(method);
|
||||
|
||||
|
@ -1044,26 +1044,25 @@ class CalDavFreeBusyRequest extends CalDavRequestBase {
|
|||
* @param {calIDateTime} aRangeEnd The end of the range
|
||||
*/
|
||||
constructor(aSession, aCalendar, aUri, aOrganizer, aRecipient, aRangeStart, aRangeEnd) {
|
||||
let ics = cal.getIcsService();
|
||||
let vcalendar = ics.createIcalComponent("VCALENDAR");
|
||||
let vcalendar = cal.icsService.createIcalComponent("VCALENDAR");
|
||||
cal.item.setStaticProps(vcalendar);
|
||||
|
||||
let method = ics.createIcalProperty("METHOD");
|
||||
let method = cal.icsService.createIcalProperty("METHOD");
|
||||
method.value = "REQUEST";
|
||||
vcalendar.addProperty(method);
|
||||
|
||||
let freebusy = ics.createIcalComponent("VFREEBUSY");
|
||||
let freebusy = cal.icsService.createIcalComponent("VFREEBUSY");
|
||||
freebusy.uid = cal.getUUID();
|
||||
freebusy.stampTime = cal.dtz.now().getInTimezone(cal.dtz.UTC);
|
||||
freebusy.startTime = aRangeStart.getInTimezone(cal.dtz.UTC);
|
||||
freebusy.endTime = aRangeEnd.getInTimezone(cal.dtz.UTC);
|
||||
vcalendar.addSubcomponent(freebusy);
|
||||
|
||||
let organizer = ics.createIcalProperty("ORGANIZER");
|
||||
let organizer = cal.icsService.createIcalProperty("ORGANIZER");
|
||||
organizer.value = aOrganizer;
|
||||
freebusy.addProperty(organizer);
|
||||
|
||||
let attendee = ics.createIcalProperty("ATTENDEE");
|
||||
let attendee = cal.icsService.createIcalProperty("ATTENDEE");
|
||||
attendee.setParameter("PARTSTAT", "NEEDS-ACTION");
|
||||
attendee.setParameter("ROLE", "REQ-PARTICIPANT");
|
||||
attendee.setParameter("CUTYPE", "INDIVIDUAL");
|
||||
|
@ -1120,7 +1119,6 @@ class FreeBusyResponse extends CalDavSimpleResponse {
|
|||
}
|
||||
|
||||
if (!this._data) {
|
||||
let icssvc = cal.getIcsService();
|
||||
this._data = {};
|
||||
for (let response of this.xml.querySelectorAll(":scope > response")) {
|
||||
let recipient = querySelectorText(response, ":scope > recipient > href");
|
||||
|
@ -1130,7 +1128,7 @@ class FreeBusyResponse extends CalDavSimpleResponse {
|
|||
if (caldata) {
|
||||
let component;
|
||||
try {
|
||||
component = icssvc.parseICS(caldata, null);
|
||||
component = cal.icsService.parseICS(caldata, null);
|
||||
} catch (e) {
|
||||
cal.LOG("CalDAV: Could not parse freebusy data: " + e);
|
||||
continue;
|
||||
|
|
|
@ -95,11 +95,11 @@ CalCompositeCalendar.prototype = {
|
|||
this.removeCalendar(calendar);
|
||||
}
|
||||
}
|
||||
|
||||
this.mPrefPrefix = aPrefPrefix;
|
||||
this.mActivePref = aPrefPrefix + "-in-composite";
|
||||
this.mDefaultPref = aPrefPrefix + "-default";
|
||||
let mgr = cal.getCalendarManager();
|
||||
let cals = mgr.getCalendars();
|
||||
let cals = cal.manager.getCalendars();
|
||||
|
||||
cals.forEach(function(calendar) {
|
||||
if (calendar.getProperty(this.mActivePref)) {
|
||||
|
|
|
@ -313,11 +313,11 @@ CalICSCalendar.prototype = {
|
|||
break;
|
||||
}
|
||||
}
|
||||
let prop = cal.getIcsService().createIcalProperty("X-WR-CALNAME");
|
||||
let prop = cal.icsService.createIcalProperty("X-WR-CALNAME");
|
||||
prop.value = this.name;
|
||||
serializer.addProperty(prop);
|
||||
prop = cal.getIcsService().createIcalProperty("X-WR-TIMEZONE");
|
||||
prop.value = cal.getTimezoneService().defaultTimezone.tzid;
|
||||
prop = cal.icsService.createIcalProperty("X-WR-TIMEZONE");
|
||||
prop.value = cal.timezoneService.defaultTimezone.tzid;
|
||||
serializer.addProperty(prop);
|
||||
|
||||
// don't call this.getItems, because we are locked:
|
||||
|
|
|
@ -435,8 +435,7 @@ class ICSDetector {
|
|||
displayName = fileName || lastPath || uri.spec;
|
||||
}
|
||||
|
||||
let calMgr = cal.getCalendarManager();
|
||||
let calendar = calMgr.createCalendar("ics", uri);
|
||||
let calendar = cal.manager.createCalendar("ics", uri);
|
||||
calendar.setProperty("color", color || cal.view.hashColor(uri.spec));
|
||||
calendar.name = displayName;
|
||||
calendar.id = cal.getUUID();
|
||||
|
|
|
@ -941,7 +941,7 @@ class CalStorageItemModel extends CalStorageModelBase {
|
|||
|
||||
getRecurrenceItemFromRow(row, item) {
|
||||
let ritem;
|
||||
let prop = cal.getIcsService().createIcalPropertyFromString(row.getResultByName("icalString"));
|
||||
let prop = cal.icsService.createIcalPropertyFromString(row.getResultByName("icalString"));
|
||||
switch (prop.propertyName) {
|
||||
case "RDATE":
|
||||
case "EXDATE":
|
||||
|
@ -996,7 +996,7 @@ class CalStorageItemModel extends CalStorageModelBase {
|
|||
if (cdt) {
|
||||
params.bindByName(entryname, cdt.nativeTime);
|
||||
let timezone = cdt.timezone;
|
||||
let ownTz = cal.getTimezoneService().getTimezone(timezone.tzid);
|
||||
let ownTz = cal.timezoneService.getTimezone(timezone.tzid);
|
||||
if (ownTz) {
|
||||
// if we know that TZID, we use it
|
||||
params.bindByName(entryname + "_tz", ownTz.tzid);
|
||||
|
|
|
@ -145,9 +145,10 @@ function getTimezone(aTimezone) {
|
|||
if (!timezone) {
|
||||
try {
|
||||
// cannot cope without parent VCALENDAR:
|
||||
let comp = cal
|
||||
.getIcsService()
|
||||
.parseICS("BEGIN:VCALENDAR\n" + aTimezone + "\nEND:VCALENDAR", null);
|
||||
let comp = cal.icsService.parseICS(
|
||||
"BEGIN:VCALENDAR\n" + aTimezone + "\nEND:VCALENDAR",
|
||||
null
|
||||
);
|
||||
timezone = new calStorageTimezone(comp.getFirstSubcomponent("VTIMEZONE"));
|
||||
gForeignTimezonesCache[aTimezone] = timezone;
|
||||
} catch (e) {
|
||||
|
@ -155,7 +156,7 @@ function getTimezone(aTimezone) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
timezone = cal.getTimezoneService().getTimezone(aTimezone);
|
||||
timezone = cal.timezoneService.getTimezone(aTimezone);
|
||||
}
|
||||
return timezone;
|
||||
}
|
||||
|
|
|
@ -438,7 +438,7 @@ function reportErrorAndRollback(db, e) {
|
|||
function ensureUpdatedTimezones(db) {
|
||||
// check if timezone version has changed:
|
||||
let selectTzVersion = createStatement(db, "SELECT version FROM cal_tz_version LIMIT 1");
|
||||
let tzServiceVersion = cal.getTimezoneService().version;
|
||||
let tzServiceVersion = cal.timezoneService.version;
|
||||
let version;
|
||||
try {
|
||||
version = selectTzVersion.executeStep() ? selectTzVersion.row.version : null;
|
||||
|
@ -483,7 +483,7 @@ function ensureUpdatedTimezones(db) {
|
|||
// Send the timezones off to the timezone service to attempt conversion:
|
||||
let timezone = getTimezone(zone);
|
||||
if (timezone) {
|
||||
let refTz = cal.getTimezoneService().getTimezone(timezone.tzid);
|
||||
let refTz = cal.timezoneService.getTimezone(timezone.tzid);
|
||||
if (refTz && refTz.tzid != zone) {
|
||||
zonesToUpdate.push({ oldTzId: zone, newTzId: refTz.tzid });
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ function ensureUpdatedTimezones(db) {
|
|||
db,
|
||||
// prettier-ignore
|
||||
"DELETE FROM cal_tz_version; " +
|
||||
`INSERT INTO cal_tz_version VALUES ('${cal.getTimezoneService().version}');`
|
||||
`INSERT INTO cal_tz_version VALUES ('${cal.timezoneService.version}');`
|
||||
);
|
||||
commitTransaction(db);
|
||||
} catch (e) {
|
||||
|
@ -1293,10 +1293,10 @@ upgrade.v16 = function(db, version) {
|
|||
// filed bug 520463. Since we want to release 1.0b1
|
||||
// soon, I will just fix this on the "client side"
|
||||
// and do the conversion here.
|
||||
alarmDate.timezone = cal.getTimezoneService().defaultTimezone;
|
||||
alarmDate.timezone = cal.timezoneService.defaultTimezone;
|
||||
alarmDate = alarmDate.getInTimezone(cal.dtz.UTC);
|
||||
} else {
|
||||
alarmDate.timezone = cal.getTimezoneService().getTimezone(aTzId);
|
||||
alarmDate.timezone = cal.timezoneService.getTimezone(aTzId);
|
||||
}
|
||||
alarm.alarmDate = alarmDate;
|
||||
}
|
||||
|
|
|
@ -666,11 +666,10 @@ const CalendarTestUtils = {
|
|||
* @returns {calICalendar}
|
||||
*/
|
||||
createCalendar(name = "Test", type = "storage") {
|
||||
let manager = cal.getCalendarManager();
|
||||
let calendar = manager.createCalendar(type, Services.io.newURI(`moz-${type}-calendar://`));
|
||||
let calendar = cal.manager.createCalendar(type, Services.io.newURI(`moz-${type}-calendar://`));
|
||||
calendar.name = name;
|
||||
calendar.setProperty("calendar-main-default", true);
|
||||
manager.registerCalendar(calendar);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
return calendar;
|
||||
},
|
||||
|
||||
|
@ -680,8 +679,7 @@ const CalendarTestUtils = {
|
|||
* @param {calICalendar} calendar - A calendar to remove.
|
||||
*/
|
||||
removeCalendar(calendar) {
|
||||
let manager = cal.getCalendarManager();
|
||||
manager.unregisterCalendar(calendar);
|
||||
cal.manager.unregisterCalendar(calendar);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,12 +9,11 @@ var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
|
|||
|
||||
add_task(async function testBasicFunctionality() {
|
||||
const calendarName = "Mochitest";
|
||||
let manager = cal.getCalendarManager();
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
for (let calendar of manager.getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
if (calendar.name == calendarName) {
|
||||
manager.removeCalendar(calendar);
|
||||
cal.manager.removeCalendar(calendar);
|
||||
}
|
||||
}
|
||||
Services.focus.focusedWindow = window;
|
||||
|
|
|
@ -92,13 +92,12 @@ add_task(async () => {
|
|||
|
||||
let calendarList = document.getElementById("calendar-list");
|
||||
let contextMenu = document.getElementById("list-calendars-context-menu");
|
||||
let manager = cal.getCalendarManager();
|
||||
let composite = cal.view.getCompositeCalendar(window);
|
||||
|
||||
await CalendarTestUtils.openCalendarTab(window);
|
||||
|
||||
// Check the default calendar.
|
||||
let calendars = manager.getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
Assert.equal(calendars.length, 1);
|
||||
Assert.equal(calendarList.rowCount, 1);
|
||||
checkProperties(0, {
|
||||
|
@ -123,7 +122,7 @@ add_task(async () => {
|
|||
calendars[i] = CalendarTestUtils.createCalendar(`Mochitest ${i}`, "memory");
|
||||
}
|
||||
|
||||
Assert.equal(manager.getCalendars().length, 4);
|
||||
Assert.equal(cal.manager.getCalendars().length, 4);
|
||||
Assert.equal(calendarList.rowCount, 4);
|
||||
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
|
@ -310,7 +309,7 @@ add_task(async () => {
|
|||
|
||||
// Delete a calendar by unregistering it.
|
||||
CalendarTestUtils.removeCalendar(calendars[3]);
|
||||
Assert.equal(manager.getCalendars().length, 3);
|
||||
Assert.equal(cal.manager.getCalendars().length, 3);
|
||||
Assert.equal(calendarList.rowCount, 3);
|
||||
checkSortOrder(0, 1, 2);
|
||||
|
||||
|
@ -319,7 +318,7 @@ add_task(async () => {
|
|||
await withMockPromptService(1, () => {
|
||||
EventUtils.synthesizeKey("VK_DELETE");
|
||||
});
|
||||
Assert.equal(manager.getCalendars().length, 3, "three calendars left in the manager");
|
||||
Assert.equal(cal.manager.getCalendars().length, 3, "three calendars left in the manager");
|
||||
Assert.equal(calendarList.rowCount, 3, "three calendars left in the list");
|
||||
checkSortOrder(0, 1, 2);
|
||||
|
||||
|
@ -327,7 +326,7 @@ add_task(async () => {
|
|||
await withMockPromptService(0, () => {
|
||||
EventUtils.synthesizeKey("VK_DELETE");
|
||||
});
|
||||
Assert.equal(manager.getCalendars().length, 2, "two calendars left in the manager");
|
||||
Assert.equal(cal.manager.getCalendars().length, 2, "two calendars left in the manager");
|
||||
Assert.equal(calendarList.rowCount, 2, "two calendars left in the list");
|
||||
checkSortOrder(0, 2);
|
||||
|
||||
|
@ -337,7 +336,7 @@ add_task(async () => {
|
|||
await calendarListContextMenu(calendarList.rows[1], "list-calendars-context-delete");
|
||||
});
|
||||
|
||||
Assert.equal(manager.getCalendars().length, 1, "one calendar left in the manager");
|
||||
Assert.equal(cal.manager.getCalendars().length, 1, "one calendar left in the manager");
|
||||
Assert.equal(calendarList.rowCount, 1, "one calendar left in the list");
|
||||
checkSortOrder(0);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ let { TelemetryTestUtils } = ChromeUtils.import("resource://testing-common/Telem
|
|||
add_task(async function test_calendar_count() {
|
||||
Services.telemetry.clearScalars();
|
||||
|
||||
let calendars = cal.getCalendarManager().getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
calendars[i] = CalendarTestUtils.createCalendar(`Mochitest ${i}`, "memory");
|
||||
if (i === 1 || i === 3) {
|
||||
|
|
|
@ -19,12 +19,11 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
*/
|
||||
add_task(async function testOpenEvent() {
|
||||
let uri = Services.io.newURI("moz-memory-calendar://");
|
||||
let manager = cal.getCalendarManager();
|
||||
let calendar = manager.createCalendar("memory", uri);
|
||||
let calendar = cal.manager.createCalendar("memory", uri);
|
||||
|
||||
calendar.name = "Unifinder Test";
|
||||
manager.registerCalendar(calendar);
|
||||
registerCleanupFunction(() => manager.removeCalendar(calendar));
|
||||
cal.manager.registerCalendar(calendar);
|
||||
registerCleanupFunction(() => cal.manager.removeCalendar(calendar));
|
||||
|
||||
let now = cal.dtz.now();
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ var { saveAndCloseItemDialog, setData } = ChromeUtils.import(
|
|||
);
|
||||
|
||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
|
||||
|
||||
const HOUR = 8;
|
||||
|
||||
|
@ -55,11 +56,9 @@ add_task(async function testLocalICS() {
|
|||
});
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
let manager = window.cal.getCalendarManager();
|
||||
|
||||
for (let calendar of manager.getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
if (calendar.name == calendarName) {
|
||||
manager.removeCalendar(calendar);
|
||||
cal.manager.removeCalendar(calendar);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -428,9 +428,9 @@ add_task(async function testActive() {
|
|||
*/
|
||||
add_task(async function testOtherTimeZones() {
|
||||
// Johannesburg is UTC+2.
|
||||
let johannesburg = cal.getTimezoneService().getTimezone("Africa/Johannesburg");
|
||||
let johannesburg = cal.timezoneService.getTimezone("Africa/Johannesburg");
|
||||
// Panama is UTC-5.
|
||||
let panama = cal.getTimezoneService().getTimezone("America/Panama");
|
||||
let panama = cal.timezoneService.getTimezone("America/Panama");
|
||||
|
||||
// All-day events are displayed on the day of the event, the time zone is ignored.
|
||||
|
||||
|
|
|
@ -10,16 +10,15 @@ const { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
|
|||
const { cloudFileAccounts } = ChromeUtils.import("resource:///modules/cloudFileAccounts.jsm");
|
||||
const { MockFilePicker } = ChromeUtils.import("resource://specialpowers/MockFilePicker.jsm");
|
||||
|
||||
let manager = cal.getCalendarManager();
|
||||
let calendar = manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let calendar = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
calendar.name = "Attachments";
|
||||
manager.registerCalendar(calendar);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
|
||||
// Remove the save prompt observer that head.js added. It's causing trouble here.
|
||||
Services.ww.unregisterNotification(savePromptObserver);
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
manager.unregisterCalendar(calendar);
|
||||
cal.manager.unregisterCalendar(calendar);
|
||||
});
|
||||
|
||||
async function getEventBox(selector) {
|
||||
|
|
|
@ -8,8 +8,7 @@ add_task(async () => {
|
|||
calendar.name = "Mochitest";
|
||||
calendar.setProperty("organizerId", "mailto:mochitest@invalid");
|
||||
|
||||
let freeBusyService = cal.getFreeBusyService();
|
||||
freeBusyService.addProvider(freeBusyProvider);
|
||||
cal.freeBusyService.addProvider(freeBusyProvider);
|
||||
|
||||
let book = MailServices.ab.getDirectoryFromId(
|
||||
MailServices.ab.newAddressBook("Mochitest", null, 101)
|
||||
|
@ -50,7 +49,7 @@ add_task(async () => {
|
|||
|
||||
registerCleanupFunction(async () => {
|
||||
CalendarTestUtils.removeCalendar(calendar);
|
||||
freeBusyService.removeProvider(freeBusyProvider);
|
||||
cal.freeBusyService.removeProvider(freeBusyProvider);
|
||||
MailServices.ab.deleteAddressBook(book.URI);
|
||||
});
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ var { saveAndCloseItemDialog, setData } = ChromeUtils.import(
|
|||
);
|
||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
let manager = cal.getCalendarManager();
|
||||
|
||||
let calendarObserver = {
|
||||
QueryInterface: ChromeUtils.generateQI(["calIObserver"]),
|
||||
|
||||
|
@ -71,14 +69,14 @@ let calendarObserver = {
|
|||
* @returns {calICalendar}
|
||||
*/
|
||||
function createCalendar(type, url, useCache) {
|
||||
let calendar = manager.createCalendar(type, Services.io.newURI(url));
|
||||
let calendar = cal.manager.createCalendar(type, Services.io.newURI(url));
|
||||
calendar.name = type + (useCache ? " with cache" : " without cache");
|
||||
calendar.id = cal.getUUID();
|
||||
calendar.setProperty("cache.enabled", useCache);
|
||||
calendar.setProperty("calendar-main-default", true);
|
||||
|
||||
manager.registerCalendar(calendar);
|
||||
calendar = manager.getCalendarById(calendar.id);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
calendar = cal.manager.getCalendarById(calendar.id);
|
||||
calendarObserver._expectedCalendar = calendar;
|
||||
calendar.addObserver(calendarObserver);
|
||||
|
||||
|
@ -93,7 +91,7 @@ function createCalendar(type, url, useCache) {
|
|||
*/
|
||||
function removeCalendar(calendar) {
|
||||
calendar.removeObserver(calendarObserver);
|
||||
manager.removeCalendar(calendar);
|
||||
cal.manager.removeCalendar(calendar);
|
||||
}
|
||||
|
||||
let alarmService = Cc["@mozilla.org/calendar/alarm-service;1"].getService(Ci.calIAlarmService);
|
||||
|
|
|
@ -248,7 +248,7 @@ function readJSONFile(aFile) {
|
|||
|
||||
function do_load_timezoneservice(callback) {
|
||||
do_test_pending();
|
||||
cal.getTimezoneService().startup({
|
||||
cal.timezoneService.startup({
|
||||
onResult() {
|
||||
do_test_finished();
|
||||
callback();
|
||||
|
@ -258,7 +258,7 @@ function do_load_timezoneservice(callback) {
|
|||
|
||||
function do_load_calmgr(callback) {
|
||||
do_test_pending();
|
||||
cal.getCalendarManager().startup({
|
||||
cal.manager.startup({
|
||||
onResult() {
|
||||
do_test_finished();
|
||||
callback();
|
||||
|
|
|
@ -13,13 +13,11 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
// The tests in this directory each do the same thing, with slight variations as needed for each
|
||||
// calendar provider. The core of the test lives in this file and the tests call it when ready.
|
||||
|
||||
let manager = cal.getCalendarManager();
|
||||
|
||||
do_get_profile();
|
||||
add_task(async () => {
|
||||
await new Promise(resolve => manager.startup({ onResult: resolve }));
|
||||
await new Promise(resolve => cal.getTimezoneService().startup({ onResult: resolve }));
|
||||
manager.addCalendarObserver(calendarObserver);
|
||||
await new Promise(resolve => cal.manager.startup({ onResult: resolve }));
|
||||
await new Promise(resolve => cal.timezoneService.startup({ onResult: resolve }));
|
||||
cal.manager.addCalendarObserver(calendarObserver);
|
||||
});
|
||||
|
||||
let calendarObserver = {
|
||||
|
@ -85,13 +83,13 @@ let calendarObserver = {
|
|||
* @returns {calICalendar}
|
||||
*/
|
||||
function createCalendar(type, url, useCache) {
|
||||
let calendar = manager.createCalendar(type, Services.io.newURI(url));
|
||||
let calendar = cal.manager.createCalendar(type, Services.io.newURI(url));
|
||||
calendar.name = type + (useCache ? " with cache" : " without cache");
|
||||
calendar.id = cal.getUUID();
|
||||
calendar.setProperty("cache.enabled", useCache);
|
||||
|
||||
manager.registerCalendar(calendar);
|
||||
calendar = manager.getCalendarById(calendar.id);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
calendar = cal.manager.getCalendarById(calendar.id);
|
||||
calendarObserver._expectedCalendar = calendar;
|
||||
|
||||
info(`Created calendar ${calendar.id}`);
|
||||
|
|
|
@ -13,7 +13,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
|
||||
function run_test() {
|
||||
// Initialize the floating timezone without actually starting the service.
|
||||
cal.getTimezoneService().floating; // eslint-disable-line no-unused-expressions
|
||||
cal.timezoneService.floating; // eslint-disable-line no-unused-expressions
|
||||
|
||||
test_initial_creation();
|
||||
|
||||
|
@ -530,18 +530,17 @@ function test_clone() {
|
|||
function test_serialize() {
|
||||
// most checks done by other tests, these don't fit into categories
|
||||
let alarm = new CalAlarm();
|
||||
let srv = cal.getIcsService();
|
||||
|
||||
throws(
|
||||
() => {
|
||||
alarm.icalComponent = srv.createIcalComponent("BARF");
|
||||
alarm.icalComponent = cal.icsService.createIcalComponent("BARF");
|
||||
},
|
||||
/0x80070057/,
|
||||
"Invalid Argument"
|
||||
);
|
||||
|
||||
function addProp(name, value) {
|
||||
let prop = srv.createIcalProperty(name);
|
||||
let prop = cal.icsService.createIcalProperty(name);
|
||||
prop.value = value;
|
||||
comp.addProperty(prop);
|
||||
}
|
||||
|
@ -571,7 +570,7 @@ function test_serialize() {
|
|||
}
|
||||
|
||||
// All is there, should not throw
|
||||
let comp = srv.createIcalComponent("VALARM");
|
||||
let comp = cal.icsService.createIcalComponent("VALARM");
|
||||
addActionDisplay();
|
||||
addTrigger();
|
||||
addDescr();
|
||||
|
@ -581,7 +580,7 @@ function test_serialize() {
|
|||
alarm.toString();
|
||||
|
||||
// Attachments and attendees
|
||||
comp = srv.createIcalComponent("VALARM");
|
||||
comp = cal.icsService.createIcalComponent("VALARM");
|
||||
addActionEmail();
|
||||
addTrigger();
|
||||
addDescr();
|
||||
|
@ -593,7 +592,7 @@ function test_serialize() {
|
|||
// Missing action
|
||||
throws(
|
||||
() => {
|
||||
comp = srv.createIcalComponent("VALARM");
|
||||
comp = cal.icsService.createIcalComponent("VALARM");
|
||||
addTrigger();
|
||||
addDescr();
|
||||
alarm.icalComponent = comp;
|
||||
|
@ -605,7 +604,7 @@ function test_serialize() {
|
|||
// Missing trigger
|
||||
throws(
|
||||
() => {
|
||||
comp = srv.createIcalComponent("VALARM");
|
||||
comp = cal.icsService.createIcalComponent("VALARM");
|
||||
addActionDisplay();
|
||||
addDescr();
|
||||
alarm.icalComponent = comp;
|
||||
|
@ -617,7 +616,7 @@ function test_serialize() {
|
|||
// Missing duration with repeat
|
||||
throws(
|
||||
() => {
|
||||
comp = srv.createIcalComponent("VALARM");
|
||||
comp = cal.icsService.createIcalComponent("VALARM");
|
||||
addActionDisplay();
|
||||
addTrigger();
|
||||
addDescr();
|
||||
|
@ -631,7 +630,7 @@ function test_serialize() {
|
|||
// Missing repeat with duration
|
||||
throws(
|
||||
() => {
|
||||
comp = srv.createIcalComponent("VALARM");
|
||||
comp = cal.icsService.createIcalComponent("VALARM");
|
||||
addActionDisplay();
|
||||
addTrigger();
|
||||
addDescr();
|
||||
|
|
|
@ -457,15 +457,14 @@ function doAcknowledgeTest(aCalendar) {
|
|||
function doRunTest(aOnCalendarCreated, aOnAlarmsLoaded) {
|
||||
alarmObserver.clear();
|
||||
|
||||
let calmgr = cal.getCalendarManager();
|
||||
let memory = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
memory.id = cal.getUUID();
|
||||
|
||||
if (aOnCalendarCreated) {
|
||||
aOnCalendarCreated.call(aOnCalendarCreated, memory);
|
||||
}
|
||||
|
||||
calmgr.registerCalendar(memory);
|
||||
cal.manager.registerCalendar(memory);
|
||||
|
||||
alarmObserver.doOnAlarmsLoaded(memory, async () => {
|
||||
if (aOnAlarmsLoaded) {
|
||||
|
|
|
@ -7,7 +7,7 @@ var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
|
|||
function run_test() {
|
||||
// In bug 523860, we found out that in the spec doublequotes should not be
|
||||
// escaped.
|
||||
let prop = cal.getIcsService().createIcalProperty("DESCRIPTION");
|
||||
let prop = cal.icsService.createIcalProperty("DESCRIPTION");
|
||||
let expected = "A String with \"quotes\" and 'other quotes'";
|
||||
|
||||
prop.value = expected;
|
||||
|
|
|
@ -162,7 +162,7 @@ class CalDavServer {
|
|||
|
||||
resetClient(client) {
|
||||
MockConflictPrompt.unregister();
|
||||
cal.getCalendarManager().unregisterCalendar(client);
|
||||
cal.manager.unregisterCalendar(client);
|
||||
}
|
||||
|
||||
waitForLoad(aCalendar) {
|
||||
|
@ -185,8 +185,7 @@ class CalDavServer {
|
|||
|
||||
getClient() {
|
||||
let uri = this.uri("/calendars/xpcshell/events");
|
||||
let calmgr = cal.getCalendarManager();
|
||||
let client = calmgr.createCalendar("caldav", uri);
|
||||
let client = cal.manager.createCalendar("caldav", uri);
|
||||
let uclient = client.wrappedJSObject;
|
||||
client.name = "xpcshell";
|
||||
client.setProperty("cache.enabled", true);
|
||||
|
@ -202,9 +201,9 @@ class CalDavServer {
|
|||
});
|
||||
});
|
||||
|
||||
calmgr.registerCalendar(client);
|
||||
cal.manager.registerCalendar(client);
|
||||
|
||||
let cachedCalendar = calmgr.getCalendarById(client.id);
|
||||
let cachedCalendar = cal.manager.getCalendarById(client.id);
|
||||
return this.waitForLoad(cachedCalendar);
|
||||
}
|
||||
|
||||
|
@ -491,11 +490,11 @@ function run_test() {
|
|||
do_get_profile();
|
||||
do_test_pending();
|
||||
|
||||
cal.getCalendarManager().startup({
|
||||
cal.manager.startup({
|
||||
onResult() {
|
||||
gServer = new CalDavServer("xpcshell@example.com");
|
||||
gServer.start();
|
||||
cal.getTimezoneService().startup({
|
||||
cal.timezoneService.startup({
|
||||
onResult() {
|
||||
run_next_test();
|
||||
do_test_finished();
|
||||
|
|
|
@ -56,17 +56,16 @@ class CalendarManagerObserver {
|
|||
|
||||
add_test(function test_builtin_registration() {
|
||||
function checkCalendarCount(net, rdonly, all) {
|
||||
equal(calmgr.networkCalendarCount, net);
|
||||
equal(calmgr.readOnlyCalendarCount, rdonly);
|
||||
equal(calmgr.calendarCount, all);
|
||||
equal(cal.manager.networkCalendarCount, net);
|
||||
equal(cal.manager.readOnlyCalendarCount, rdonly);
|
||||
equal(cal.manager.calendarCount, all);
|
||||
}
|
||||
|
||||
// Initially there should be no calendars.
|
||||
let calmgr = cal.getCalendarManager();
|
||||
checkCalendarCount(0, 0, 0);
|
||||
|
||||
// Create a local memory calendar, this shouldn't register any calendars.
|
||||
let memory = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
checkCalendarCount(0, 0, 0);
|
||||
|
||||
// Register an observer to test it.
|
||||
|
@ -82,10 +81,10 @@ add_test(function test_builtin_registration() {
|
|||
});
|
||||
|
||||
memory.addObserver(calendarObserver);
|
||||
calmgr.addObserver(calmgrObserver);
|
||||
cal.manager.addObserver(calmgrObserver);
|
||||
|
||||
// Register the calendar and check if its counted and observed.
|
||||
calmgr.registerCalendar(memory);
|
||||
cal.manager.registerCalendar(memory);
|
||||
calmgrObserver.check({ registered: memory.id });
|
||||
checkCalendarCount(0, 0, 1);
|
||||
|
||||
|
@ -93,34 +92,34 @@ add_test(function test_builtin_registration() {
|
|||
notEqual(memory.id, null);
|
||||
|
||||
// And be in the list of calendars.
|
||||
equal(memory, calmgr.getCalendarById(memory.id));
|
||||
ok(calmgr.getCalendars().some(x => x.id == memory.id));
|
||||
equal(memory, cal.manager.getCalendarById(memory.id));
|
||||
ok(cal.manager.getCalendars().some(x => x.id == memory.id));
|
||||
|
||||
// Make it readonly and check if the observer caught it.
|
||||
memory.setProperty("readOnly", true);
|
||||
equal(readOnly, true);
|
||||
|
||||
// Now unregister it.
|
||||
calmgr.unregisterCalendar(memory);
|
||||
cal.manager.unregisterCalendar(memory);
|
||||
calmgrObserver.check({ unregistering: memory.id });
|
||||
checkCalendarCount(0, 0, 0);
|
||||
|
||||
// The calendar shouldn't be in the list of ids.
|
||||
equal(calmgr.getCalendarById(memory.id), null);
|
||||
ok(calmgr.getCalendars().every(x => x.id != memory.id));
|
||||
equal(cal.manager.getCalendarById(memory.id), null);
|
||||
ok(cal.manager.getCalendars().every(x => x.id != memory.id));
|
||||
|
||||
// And finally delete it.
|
||||
calmgr.removeCalendar(memory, Ci.calICalendarManager.REMOVE_NO_UNREGISTER);
|
||||
cal.manager.removeCalendar(memory, Ci.calICalendarManager.REMOVE_NO_UNREGISTER);
|
||||
calmgrObserver.check({ deleting: memory.id });
|
||||
checkCalendarCount(0, 0, 0);
|
||||
|
||||
// Now remove the observer again.
|
||||
calmgr.removeObserver(calmgrObserver);
|
||||
cal.manager.removeObserver(calmgrObserver);
|
||||
memory.removeObserver(calendarObserver);
|
||||
|
||||
// Check if removing it actually worked.
|
||||
calmgr.registerCalendar(memory);
|
||||
calmgr.removeCalendar(memory);
|
||||
cal.manager.registerCalendar(memory);
|
||||
cal.manager.removeCalendar(memory);
|
||||
memory.setProperty("readOnly", false);
|
||||
calmgrObserver.check({});
|
||||
equal(readOnly, true);
|
||||
|
@ -146,7 +145,7 @@ add_task(async function test_dynamic_registration() {
|
|||
}
|
||||
|
||||
function checkCalendar(expectedCount = 1) {
|
||||
let calendars = calmgr.getCalendars();
|
||||
let calendars = cal.manager.getCalendars();
|
||||
equal(calendars.length, expectedCount);
|
||||
let calendar = calendars[0];
|
||||
|
||||
|
@ -156,32 +155,31 @@ add_task(async function test_dynamic_registration() {
|
|||
return calendar;
|
||||
}
|
||||
|
||||
let calmgr = cal.getCalendarManager();
|
||||
let calmgrObserver = new CalendarManagerObserver();
|
||||
calmgr.addObserver(calmgrObserver);
|
||||
equal(calmgr.calendarCount, 0);
|
||||
cal.manager.addObserver(calmgrObserver);
|
||||
equal(cal.manager.calendarCount, 0);
|
||||
|
||||
// No provider registered.
|
||||
let calendar = calmgr.createCalendar("blm", Services.io.newURI("black-lives-matter://"));
|
||||
let calendar = cal.manager.createCalendar("blm", Services.io.newURI("black-lives-matter://"));
|
||||
equal(calendar, null);
|
||||
ok(!calmgr.hasCalendarProvider("blm"));
|
||||
ok(!cal.manager.hasCalendarProvider("blm"));
|
||||
|
||||
// Register dynamic provider.
|
||||
calmgr.registerCalendarProvider("blm", CalendarProvider);
|
||||
calendar = calmgr.createCalendar("blm", Services.io.newURI("black-lives-matter://"));
|
||||
cal.manager.registerCalendarProvider("blm", CalendarProvider);
|
||||
calendar = cal.manager.createCalendar("blm", Services.io.newURI("black-lives-matter://"));
|
||||
notEqual(calendar, null);
|
||||
ok(calendar.wrappedJSObject instanceof CalendarProvider);
|
||||
ok(calmgr.hasCalendarProvider("blm"));
|
||||
ok(cal.manager.hasCalendarProvider("blm"));
|
||||
|
||||
// Register a calendar using it.
|
||||
calmgr.registerCalendar(calendar);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
calendar = checkCalendar();
|
||||
|
||||
let originalId = calendar.id;
|
||||
calmgrObserver.check({ registered: originalId });
|
||||
|
||||
// Unregister the provider from under its feet.
|
||||
calmgr.unregisterCalendarProvider("blm");
|
||||
cal.manager.unregisterCalendarProvider("blm");
|
||||
calendar = checkCalendar();
|
||||
calmgrObserver.check({ unregistering: originalId, registered: originalId });
|
||||
|
||||
|
@ -190,7 +188,7 @@ add_task(async function test_dynamic_registration() {
|
|||
equal(calendar.id, originalId);
|
||||
|
||||
// Re-register the provider should reactive it.
|
||||
calmgr.registerCalendarProvider("blm", CalendarProvider);
|
||||
cal.manager.registerCalendarProvider("blm", CalendarProvider);
|
||||
calendar = checkCalendar();
|
||||
calmgrObserver.check({ unregistering: originalId, registered: originalId });
|
||||
|
||||
|
@ -199,12 +197,12 @@ add_task(async function test_dynamic_registration() {
|
|||
equal(calendar.id, originalId);
|
||||
|
||||
// Make sure calendar is loaded from prefs.
|
||||
calmgr.unregisterCalendarProvider("blm");
|
||||
cal.manager.unregisterCalendarProvider("blm");
|
||||
calmgrObserver.check({ unregistering: originalId, registered: originalId });
|
||||
|
||||
await new Promise(resolve => calmgr.shutdown({ onResult: resolve }));
|
||||
calmgr.wrappedJSObject.mCache = null;
|
||||
await new Promise(resolve => calmgr.startup({ onResult: resolve }));
|
||||
await new Promise(resolve => cal.manager.shutdown({ onResult: resolve }));
|
||||
cal.manager.wrappedJSObject.mCache = null;
|
||||
await new Promise(resolve => cal.manager.startup({ onResult: resolve }));
|
||||
calmgrObserver.check({});
|
||||
|
||||
calendar = checkCalendar();
|
||||
|
@ -213,7 +211,7 @@ add_task(async function test_dynamic_registration() {
|
|||
equal(calendar.id, originalId);
|
||||
|
||||
// Unregister the calendar for cleanup.
|
||||
calmgr.unregisterCalendar(calendar);
|
||||
cal.manager.unregisterCalendar(calendar);
|
||||
checkCalendar(0);
|
||||
calmgrObserver.check({ unregistering: originalId });
|
||||
});
|
||||
|
@ -234,9 +232,8 @@ add_test(function test_calobserver() {
|
|||
}
|
||||
|
||||
// First of all we need a local calendar to work on and some variables
|
||||
let calmgr = cal.getCalendarManager();
|
||||
let memory = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let memory2 = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let memory2 = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let calcounter, allcounter;
|
||||
|
||||
// These observers will end up counting calls which we will use later on
|
||||
|
@ -253,9 +250,9 @@ add_test(function test_calobserver() {
|
|||
|
||||
// Set up counters and observers
|
||||
resetCounters();
|
||||
calmgr.registerCalendar(memory);
|
||||
calmgr.registerCalendar(memory2);
|
||||
calmgr.addCalendarObserver(allobs);
|
||||
cal.manager.registerCalendar(memory);
|
||||
cal.manager.registerCalendar(memory2);
|
||||
cal.manager.addCalendarObserver(allobs);
|
||||
memory.addObserver(calobs);
|
||||
|
||||
// Add an item
|
||||
|
@ -287,7 +284,7 @@ add_test(function test_calobserver() {
|
|||
|
||||
// Remove observers
|
||||
memory.removeObserver(calobs);
|
||||
calmgr.removeCalendarObserver(allobs);
|
||||
cal.manager.removeCalendarObserver(allobs);
|
||||
|
||||
// Make sure removing it actually worked
|
||||
memory.addItem(item, null);
|
||||
|
@ -301,15 +298,15 @@ add_test(function test_calobserver() {
|
|||
|
||||
add_test(function test_removeModes() {
|
||||
function checkCounts(modes, shouldDelete, expectCount, extraFlags = 0) {
|
||||
if (calmgr.calendarCount == baseCalendarCount) {
|
||||
calmgr.registerCalendar(memory);
|
||||
equal(calmgr.calendarCount, baseCalendarCount + 1);
|
||||
if (cal.manager.calendarCount == baseCalendarCount) {
|
||||
cal.manager.registerCalendar(memory);
|
||||
equal(cal.manager.calendarCount, baseCalendarCount + 1);
|
||||
}
|
||||
deleteCalled = false;
|
||||
removeModes = modes;
|
||||
|
||||
calmgr.removeCalendar(memory, extraFlags);
|
||||
equal(calmgr.calendarCount, baseCalendarCount + expectCount);
|
||||
cal.manager.removeCalendar(memory, extraFlags);
|
||||
equal(cal.manager.calendarCount, baseCalendarCount + expectCount);
|
||||
equal(deleteCalled, shouldDelete);
|
||||
}
|
||||
function mockCalendar(memory) {
|
||||
|
@ -332,9 +329,8 @@ add_test(function test_removeModes() {
|
|||
const SHOULD_DELETE = true,
|
||||
SHOULD_NOT_DELETE = false;
|
||||
|
||||
let calmgr = cal.getCalendarManager();
|
||||
let memory = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let baseCalendarCount = calmgr.calendarCount;
|
||||
let memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
let baseCalendarCount = cal.manager.calendarCount;
|
||||
let removeModes = null;
|
||||
let deleteCalled = false;
|
||||
|
||||
|
@ -356,9 +352,8 @@ add_test(function test_removeModes() {
|
|||
|
||||
add_test(function test_calprefs() {
|
||||
let prop;
|
||||
let calmgr = cal.getCalendarManager();
|
||||
let memory = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
calmgr.registerCalendar(memory);
|
||||
let memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
cal.manager.registerCalendar(memory);
|
||||
let memid = memory.id;
|
||||
|
||||
// First set a few values, one of each relevant type
|
||||
|
@ -370,7 +365,7 @@ add_test(function test_calprefs() {
|
|||
|
||||
// Before checking the value, reinitialize the memory calendar with the
|
||||
// same id to make sure the pref value isn't just cached
|
||||
memory = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
memory.id = memid;
|
||||
|
||||
// First test the standard types
|
||||
|
@ -397,17 +392,17 @@ add_test(function test_calprefs() {
|
|||
|
||||
// Check if changing pref types works. We need to reset the calendar again
|
||||
// because retrieving the value just cached it again.
|
||||
memory = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
memory.id = memid;
|
||||
|
||||
calmgr.setCalendarPref_(memory, "boolpref", "kinda true");
|
||||
cal.manager.setCalendarPref_(memory, "boolpref", "kinda true");
|
||||
prop = memory.getProperty("boolpref");
|
||||
equal(typeof prop, "string");
|
||||
equal(prop, "kinda true");
|
||||
|
||||
// Check if unsetting a pref works
|
||||
memory.setProperty("intpref", null);
|
||||
memory = calmgr.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
|
||||
memory.id = memid;
|
||||
prop = memory.getProperty("intpref");
|
||||
ok(prop === null);
|
||||
|
|
|
@ -14,7 +14,7 @@ function run_test() {
|
|||
|
||||
function really_run_test() {
|
||||
function getMozTimezone(tzid) {
|
||||
return cal.getTimezoneService().getTimezone(tzid);
|
||||
return cal.timezoneService.getTimezone(tzid);
|
||||
}
|
||||
|
||||
let date = cal.createDateTime();
|
||||
|
|
|
@ -40,14 +40,14 @@ add_task(async function formatDate_test() {
|
|||
let tzlocal = Services.prefs.getStringPref("calendar.timezone.local", "Pacific/Fakaofo");
|
||||
Services.prefs.setStringPref("calendar.timezone.local", "Pacific/Fakaofo");
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
|
||||
let i = 0;
|
||||
for (let test of data) {
|
||||
i++;
|
||||
Services.prefs.setIntPref("calendar.date.format", test.input.dateformat);
|
||||
let zone =
|
||||
test.input.timezone == "floating" ? cal.dtz.floating : tzs.getTimezone(test.input.timezone);
|
||||
test.input.timezone == "floating"
|
||||
? cal.dtz.floating
|
||||
: cal.timezoneService.getTimezone(test.input.timezone);
|
||||
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
|
||||
|
||||
let formatted = formatter.formatDate(date);
|
||||
|
@ -127,14 +127,14 @@ add_task(async function formatDateShort_test() {
|
|||
// we make sure to have set long format
|
||||
Services.prefs.setIntPref("calendar.date.format", 0);
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
|
||||
let i = 0;
|
||||
for (let test of data) {
|
||||
i++;
|
||||
|
||||
let zone =
|
||||
test.input.timezone == "floating" ? cal.dtz.floating : tzs.getTimezone(test.input.timezone);
|
||||
test.input.timezone == "floating"
|
||||
? cal.dtz.floating
|
||||
: cal.timezoneService.getTimezone(test.input.timezone);
|
||||
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
|
||||
|
||||
let formatted = formatter.formatDateShort(date);
|
||||
|
@ -214,14 +214,14 @@ add_task(async function formatDateLong_test() {
|
|||
// we make sure to have set short format
|
||||
Services.prefs.setIntPref("calendar.date.format", 1);
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
|
||||
let i = 0;
|
||||
for (let test of data) {
|
||||
i++;
|
||||
|
||||
let zone =
|
||||
test.input.timezone == "floating" ? cal.dtz.floating : tzs.getTimezone(test.input.timezone);
|
||||
test.input.timezone == "floating"
|
||||
? cal.dtz.floating
|
||||
: cal.timezoneService.getTimezone(test.input.timezone);
|
||||
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
|
||||
|
||||
let formatted = formatter.formatDateLong(date);
|
||||
|
@ -301,14 +301,14 @@ add_task(async function formatDateWithoutYear_test() {
|
|||
// we make sure to have set short format
|
||||
Services.prefs.setIntPref("calendar.date.format", 1);
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
|
||||
let i = 0;
|
||||
for (let test of data) {
|
||||
i++;
|
||||
|
||||
let zone =
|
||||
test.input.timezone == "floating" ? cal.dtz.floating : tzs.getTimezone(test.input.timezone);
|
||||
test.input.timezone == "floating"
|
||||
? cal.dtz.floating
|
||||
: cal.timezoneService.getTimezone(test.input.timezone);
|
||||
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
|
||||
|
||||
equal(formatter.formatDateWithoutYear(date), test.expected, "(test #" + i + ")");
|
||||
|
@ -384,14 +384,14 @@ add_task(async function formatDateLongWithoutYear_test() {
|
|||
// we make sure to have set short format
|
||||
Services.prefs.setIntPref("calendar.date.format", 1);
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
|
||||
let i = 0;
|
||||
for (let test of data) {
|
||||
i++;
|
||||
|
||||
let zone =
|
||||
test.input.timezone == "floating" ? cal.dtz.floating : tzs.getTimezone(test.input.timezone);
|
||||
test.input.timezone == "floating"
|
||||
? cal.dtz.floating
|
||||
: cal.timezoneService.getTimezone(test.input.timezone);
|
||||
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
|
||||
|
||||
equal(formatter.formatDateLongWithoutYear(date), test.expected, "(test #" + i + ")");
|
||||
|
@ -443,14 +443,14 @@ add_task(async function formatTime_test() {
|
|||
let tzlocal = Services.prefs.getStringPref("calendar.timezone.local", "Pacific/Fakaofo");
|
||||
Services.prefs.setStringPref("calendar.timezone.local", "Pacific/Fakaofo");
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
|
||||
let i = 0;
|
||||
for (let test of data) {
|
||||
i++;
|
||||
|
||||
let zone =
|
||||
test.input.timezone == "floating" ? cal.dtz.floating : tzs.getTimezone(test.input.timezone);
|
||||
test.input.timezone == "floating"
|
||||
? cal.dtz.floating
|
||||
: cal.timezoneService.getTimezone(test.input.timezone);
|
||||
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
|
||||
|
||||
let formatted = formatter.formatTime(date);
|
||||
|
|
|
@ -27,7 +27,6 @@ function check_delmgr_call(aFunc) {
|
|||
}
|
||||
|
||||
add_task(async function test_deleted_items() {
|
||||
let calmgr = cal.getCalendarManager();
|
||||
let delmgr = Cc["@mozilla.org/calendar/deleted-items-manager;1"].getService(Ci.calIDeletedItems);
|
||||
// No items have been deleted, retrieving one should return null.
|
||||
equal(delmgr.getDeletedDate("random"), null);
|
||||
|
@ -37,8 +36,8 @@ add_task(async function test_deleted_items() {
|
|||
// error.
|
||||
await check_delmgr_call(() => delmgr.flush());
|
||||
|
||||
let memory = calmgr.createCalendar("memory", Services.io.newURI("moz-storage-calendar://"));
|
||||
calmgr.registerCalendar(memory);
|
||||
let memory = cal.manager.createCalendar("memory", Services.io.newURI("moz-storage-calendar://"));
|
||||
cal.manager.registerCalendar(memory);
|
||||
|
||||
let item = new CalEvent();
|
||||
item.id = "test-item-1";
|
||||
|
|
|
@ -789,7 +789,7 @@ add_task(async function testChangeWhileRefreshing() {
|
|||
});
|
||||
},
|
||||
};
|
||||
cal.getCalendarManager().registerCalendar(pumpCalendar);
|
||||
cal.manager.registerCalendar(pumpCalendar);
|
||||
|
||||
// Create a new widget and a Promise waiting for it to be ready.
|
||||
|
||||
|
|
|
@ -124,8 +124,6 @@ function test_roundtrip() {
|
|||
}
|
||||
}
|
||||
|
||||
let icssrv = cal.getIcsService();
|
||||
|
||||
for (let data of test_data) {
|
||||
// First round, use the icalString setter which uses synchronous parsing
|
||||
dump("Checking" + data.ics + "\n");
|
||||
|
@ -137,7 +135,7 @@ function test_roundtrip() {
|
|||
// foreach loop iterations.
|
||||
do_test_pending();
|
||||
let thisdata = data;
|
||||
icssrv.parseICSAsync(data.ics, null, {
|
||||
cal.icsService.parseICSAsync(data.ics, null, {
|
||||
onParsingComplete(rc, rootComp) {
|
||||
try {
|
||||
ok(Components.isSuccessCode(rc));
|
||||
|
@ -177,9 +175,8 @@ function test_icalProps() {
|
|||
*/
|
||||
|
||||
function checkIcalProp(aPropName, aObj) {
|
||||
let icssvc = cal.getIcsService();
|
||||
let prop1 = icssvc.createIcalProperty(aPropName);
|
||||
let prop2 = icssvc.createIcalProperty(aPropName);
|
||||
let prop1 = cal.icsService.createIcalProperty(aPropName);
|
||||
let prop2 = cal.icsService.createIcalProperty(aPropName);
|
||||
prop1.value = "foo";
|
||||
prop2.value = "bar";
|
||||
prop1.setParameter("X-FOO", "BAR");
|
||||
|
@ -230,7 +227,7 @@ function test_duration() {
|
|||
|
||||
function test_serialize() {
|
||||
let e = new CalEvent();
|
||||
let prop = cal.getIcsService().createIcalComponent("VTODO");
|
||||
let prop = cal.icsService.createIcalComponent("VTODO");
|
||||
|
||||
throws(() => {
|
||||
e.icalComponent = prop;
|
||||
|
|
|
@ -114,8 +114,6 @@ function test_icalstring() {
|
|||
}
|
||||
|
||||
function test_icsservice() {
|
||||
let svc = cal.getIcsService();
|
||||
|
||||
function checkProp(createFunc, icalString, members, parameters) {
|
||||
let thing = createFunc(icalString);
|
||||
equal(ics_unfoldline(thing.icalString), icalString + "\r\n");
|
||||
|
@ -132,14 +130,14 @@ function test_icsservice() {
|
|||
|
||||
// Test ::createIcalPropertyFromString
|
||||
checkProp(
|
||||
svc.createIcalPropertyFromString.bind(svc),
|
||||
cal.icsService.createIcalPropertyFromString.bind(cal.icsService),
|
||||
"ATTACH;ENCODING=BASE64;FMTTYPE=text/calendar;FILENAME=test.ics:http://example.com/test.ics",
|
||||
{ value: "http://example.com/test.ics", propertyName: "ATTACH" },
|
||||
{ ENCODING: "BASE64", FMTTYPE: "text/calendar", FILENAME: "test.ics" }
|
||||
);
|
||||
|
||||
checkProp(
|
||||
svc.createIcalPropertyFromString.bind(svc),
|
||||
cal.icsService.createIcalPropertyFromString.bind(cal.icsService),
|
||||
"DESCRIPTION:new\\nlines\\nare\\ngreat\\,eh?",
|
||||
{
|
||||
value: "new\nlines\nare\ngreat,eh?",
|
||||
|
@ -149,50 +147,48 @@ function test_icsservice() {
|
|||
);
|
||||
|
||||
// Test ::createIcalProperty
|
||||
let attach2 = svc.createIcalProperty("ATTACH");
|
||||
let attach2 = cal.icsService.createIcalProperty("ATTACH");
|
||||
equal(attach2.propertyName, "ATTACH");
|
||||
attach2.value = "http://example.com/";
|
||||
equal(attach2.icalString, "ATTACH:http://example.com/\r\n");
|
||||
}
|
||||
|
||||
function test_icalproperty() {
|
||||
let svc = cal.getIcsService();
|
||||
let comp = svc.createIcalComponent("VEVENT");
|
||||
let prop = svc.createIcalProperty("PROP");
|
||||
let comp = cal.icsService.createIcalComponent("VEVENT");
|
||||
let prop = cal.icsService.createIcalProperty("PROP");
|
||||
prop.value = "VAL";
|
||||
|
||||
comp.addProperty(prop);
|
||||
equal(prop.parent.toString(), comp.toString());
|
||||
equal(prop.valueAsDatetime, null);
|
||||
|
||||
prop = svc.createIcalProperty("DESCRIPTION");
|
||||
prop = cal.icsService.createIcalProperty("DESCRIPTION");
|
||||
prop.value = "A\nB";
|
||||
equal(prop.value, "A\nB");
|
||||
equal(prop.valueAsIcalString, "A\\nB");
|
||||
equal(prop.valueAsDatetime, null);
|
||||
|
||||
prop = svc.createIcalProperty("DESCRIPTION");
|
||||
prop = cal.icsService.createIcalProperty("DESCRIPTION");
|
||||
prop.valueAsIcalString = "A\\nB";
|
||||
equal(prop.value, "A\nB");
|
||||
equal(prop.valueAsIcalString, "A\\nB");
|
||||
equal(prop.valueAsDatetime, null);
|
||||
|
||||
prop = svc.createIcalProperty("DESCRIPTION");
|
||||
prop = cal.icsService.createIcalProperty("DESCRIPTION");
|
||||
prop.value = "A\\nB";
|
||||
equal(prop.value, "A\\nB");
|
||||
equal(prop.valueAsIcalString, "A\\\\nB");
|
||||
equal(prop.valueAsDatetime, null);
|
||||
|
||||
prop = svc.createIcalProperty("GEO");
|
||||
prop = cal.icsService.createIcalProperty("GEO");
|
||||
prop.value = "43.4913662534171;12.085559129715";
|
||||
equal(prop.value, "43.4913662534171;12.085559129715");
|
||||
equal(prop.valueAsIcalString, "43.4913662534171;12.085559129715");
|
||||
}
|
||||
|
||||
function test_icalcomponent() {
|
||||
let svc = cal.getIcsService();
|
||||
let event = svc.createIcalComponent("VEVENT");
|
||||
let alarm = svc.createIcalComponent("VALARM");
|
||||
let event = cal.icsService.createIcalComponent("VEVENT");
|
||||
let alarm = cal.icsService.createIcalComponent("VALARM");
|
||||
event.addSubcomponent(alarm);
|
||||
|
||||
// Check that the parent works and does not appear on cloned instances
|
||||
|
@ -239,8 +235,7 @@ function test_icalcomponent() {
|
|||
}
|
||||
|
||||
function test_param() {
|
||||
let svc = cal.getIcsService();
|
||||
let prop = svc.createIcalProperty("DTSTART");
|
||||
let prop = cal.icsService.createIcalProperty("DTSTART");
|
||||
prop.value = "20120101T010101";
|
||||
equal(prop.icalString, "DTSTART:20120101T010101\r\n");
|
||||
prop.setParameter("VALUE", "TEXT");
|
||||
|
@ -255,13 +250,11 @@ function test_param() {
|
|||
}
|
||||
|
||||
function test_iterator() {
|
||||
let svc = cal.getIcsService();
|
||||
|
||||
// Property iterator
|
||||
let comp = svc.createIcalComponent("VEVENT");
|
||||
let comp = cal.icsService.createIcalComponent("VEVENT");
|
||||
let propNames = ["X-ONE", "X-TWO"];
|
||||
for (let i = 0; i < propNames.length; i++) {
|
||||
let prop = svc.createIcalProperty(propNames[i]);
|
||||
let prop = cal.icsService.createIcalProperty(propNames[i]);
|
||||
prop.value = "" + (i + 1);
|
||||
comp.addProperty(prop);
|
||||
}
|
||||
|
@ -278,7 +271,7 @@ function test_iterator() {
|
|||
|
||||
// Property iterator with multiple values
|
||||
// eslint-disable-next-line no-useless-concat
|
||||
comp = svc.parseICS("BEGIN:VEVENT\r\n" + "CATEGORIES:a,b,c\r\n" + "END:VEVENT", null);
|
||||
comp = cal.icsService.parseICS("BEGIN:VEVENT\r\n" + "CATEGORIES:a,b,c\r\n" + "END:VEVENT", null);
|
||||
let propValues = ["a", "b", "c"];
|
||||
for (
|
||||
let prop = comp.getFirstProperty("CATEGORIES");
|
||||
|
@ -291,7 +284,7 @@ function test_iterator() {
|
|||
}
|
||||
|
||||
// Param iterator
|
||||
let dtstart = svc.createIcalProperty("DTSTART");
|
||||
let dtstart = cal.icsService.createIcalProperty("DTSTART");
|
||||
let params = ["X-ONE", "X-TWO"];
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
dtstart.setParameter(params[i], "" + (i + 1));
|
||||
|
|
|
@ -211,7 +211,7 @@ function test_immutable() {
|
|||
let event = new CalEvent();
|
||||
|
||||
let date = cal.createDateTime();
|
||||
date.timezone = cal.getTimezoneService().getTimezone("Europe/Berlin");
|
||||
date.timezone = cal.timezoneService.getTimezone("Europe/Berlin");
|
||||
event.alarmLastAck = date;
|
||||
|
||||
let org = new CalAttendee();
|
||||
|
|
|
@ -1009,7 +1009,7 @@ function test_rrule_interface() {
|
|||
// untilDate (without UTC)
|
||||
rrule.count = 3;
|
||||
let untilDate = cal.createDateTime();
|
||||
untilDate.timezone = cal.getTimezoneService().getTimezone("Europe/Berlin");
|
||||
untilDate.timezone = cal.timezoneService.getTimezone("Europe/Berlin");
|
||||
rrule.untilDate = untilDate;
|
||||
ok(!rrule.isByCount);
|
||||
throws(() => rrule.count, /0x80004005/);
|
||||
|
|
|
@ -67,7 +67,7 @@ function really_run_test() {
|
|||
*/
|
||||
|
||||
// An arbitrary timezone (that has daylight savings time).
|
||||
let getTz = aTz => cal.getTimezoneService().getTimezone(aTz);
|
||||
let getTz = aTz => cal.timezoneService.getTimezone(aTz);
|
||||
let timezone = getTz("America/New_York");
|
||||
let utc = cal.dtz.UTC;
|
||||
// Timezones used in tests.
|
||||
|
|
|
@ -10,15 +10,12 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
cal
|
||||
.getTimezoneService()
|
||||
.QueryInterface(Ci.calIStartupService)
|
||||
.startup({
|
||||
onResult() {
|
||||
really_run_test();
|
||||
do_test_finished();
|
||||
},
|
||||
});
|
||||
cal.timezoneService.QueryInterface(Ci.calIStartupService).startup({
|
||||
onResult() {
|
||||
really_run_test();
|
||||
do_test_finished();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function really_run_test() {
|
||||
|
@ -81,14 +78,12 @@ function really_run_test() {
|
|||
"",
|
||||
].join("\r\n");
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
|
||||
event.icalString = str;
|
||||
|
||||
let startDate = event.startDate;
|
||||
let endDate = event.endDate;
|
||||
|
||||
startDate.timezone = tzs.getTimezone(startDate.timezone.tzid);
|
||||
endDate.timezone = tzs.getTimezone(endDate.timezone.tzid);
|
||||
startDate.timezone = cal.timezoneService.getTimezone(startDate.timezone.tzid);
|
||||
endDate.timezone = cal.timezoneService.getTimezone(endDate.timezone.tzid);
|
||||
notEqual(strTz, startDate.timezone.toString());
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ function run_test() {
|
|||
// This test requires timezone data going back to 2016. It's been kept here as an example.
|
||||
/* add_test(function testCaracas() {
|
||||
let time = cal.createDateTime();
|
||||
let zone = cal.getTimezoneService().getTimezone("America/Caracas");
|
||||
let zone = cal.timezoneService.getTimezone("America/Caracas");
|
||||
|
||||
for (let month = JANUARY; month <= DECEMBER; month++) {
|
||||
time.resetTo(2015, month, 1, 0, 0, 0, zone);
|
||||
|
@ -51,7 +51,7 @@ function run_test() {
|
|||
// Updated for 2019b: Brazil no longer has DST.
|
||||
add_test(function testSaoPaulo() {
|
||||
let time = cal.createDateTime();
|
||||
let zone = cal.getTimezoneService().getTimezone("America/Sao_Paulo");
|
||||
let zone = cal.timezoneService.getTimezone("America/Sao_Paulo");
|
||||
|
||||
time.resetTo(2018, FEBRUARY, 17, 0, 0, 0, zone);
|
||||
equal(time.timezoneOffset, UTC_MINUS_2, time.toString());
|
||||
|
|
|
@ -17,14 +17,13 @@ function valid_tz_version(aVersionString) {
|
|||
|
||||
// check tz database version
|
||||
add_task(async function version_test() {
|
||||
let tzs = cal.getTimezoneService();
|
||||
ok(valid_tz_version(tzs.version), "timezone version");
|
||||
ok(valid_tz_version(cal.timezoneService.version), "timezone version");
|
||||
});
|
||||
|
||||
// check whether all tz definitions have all properties
|
||||
add_task(async function zone_test() {
|
||||
function resolveZone(aZoneId) {
|
||||
let timezone = tzs.getTimezone(aZoneId);
|
||||
let timezone = cal.timezoneService.getTimezone(aZoneId);
|
||||
equal(aZoneId, timezone.tzid, "Zone test " + aZoneId);
|
||||
ok(
|
||||
timezone.icalComponent.serializeToICS().startsWith("BEGIN:VTIMEZONE"),
|
||||
|
@ -37,9 +36,8 @@ add_task(async function zone_test() {
|
|||
);
|
||||
}
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
let foundZone = false;
|
||||
for (let zone of tzs.timezoneIds) {
|
||||
for (let zone of cal.timezoneService.timezoneIds) {
|
||||
foundZone = true;
|
||||
resolveZone(zone);
|
||||
}
|
||||
|
@ -50,14 +48,13 @@ add_task(async function zone_test() {
|
|||
// check whether all tz aliases resolve to a tz definition
|
||||
add_task(async function alias_test() {
|
||||
function resolveAlias(aAliasId) {
|
||||
let timezone = tzs.getTimezone(aAliasId);
|
||||
let timezone = cal.timezoneService.getTimezone(aAliasId);
|
||||
let tzid = timezone && timezone.tzid ? timezone.tzid : "";
|
||||
notEqual(tzid, "", "Alias resolution " + aAliasId + " -> " + tzid);
|
||||
}
|
||||
|
||||
let tzs = cal.getTimezoneService();
|
||||
let foundAlias = false;
|
||||
for (let aliasId of tzs.aliasIds) {
|
||||
for (let aliasId of cal.timezoneService.aliasIds) {
|
||||
foundAlias = true;
|
||||
resolveAlias(aliasId);
|
||||
}
|
||||
|
@ -81,8 +78,7 @@ add_task(async function completeness_test() {
|
|||
// convenience, that must not be used without being modified manually to comply with a
|
||||
// previous tz version.
|
||||
notEqual(test.version, "2.1969z", "Check for dummy test data.");
|
||||
let tzs = cal.getTimezoneService();
|
||||
let comp = Services.vc.compare(test.version, tzs.version);
|
||||
let comp = Services.vc.compare(test.version, cal.timezoneService.version);
|
||||
|
||||
// some checks on the test data
|
||||
if (comp != -1) {
|
||||
|
@ -95,7 +91,7 @@ add_task(async function completeness_test() {
|
|||
break;
|
||||
}
|
||||
info("test data: " + test.version);
|
||||
info("tz service: " + tzs.version);
|
||||
info("tz service: " + cal.timezoneService.version);
|
||||
info(
|
||||
"This indicates a problem in update-zones.py or manually additions to" +
|
||||
"zones.json or previous.json"
|
||||
|
@ -109,10 +105,18 @@ add_task(async function completeness_test() {
|
|||
// definition got transformed into alias linked to a valid zone - so, there's no need for
|
||||
// separate test step to cover that)
|
||||
for (let alias of test.aliases) {
|
||||
notEqual(tzs.getTimezone(alias), null, "Test Alias " + alias + " from " + test.version);
|
||||
notEqual(
|
||||
cal.timezoneService.getTimezone(alias),
|
||||
null,
|
||||
"Test Alias " + alias + " from " + test.version
|
||||
);
|
||||
}
|
||||
for (let zone of test.zones) {
|
||||
notEqual(tzs.getTimezone(zone), null, "Test Zone " + zone + " from " + test.version);
|
||||
notEqual(
|
||||
cal.timezoneService.getTimezone(zone),
|
||||
null,
|
||||
"Test Zone " + zone + " from " + test.version
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ function run_test() {
|
|||
Services.prefs.setIntPref("calendar.week.start", weekStart);
|
||||
let date = cal.createDateTime(dateString);
|
||||
date.isDate = true;
|
||||
let week = cal.getWeekInfoService().getWeekTitle(date);
|
||||
let week = cal.weekInfoService.getWeekTitle(date);
|
||||
|
||||
equal(week, weekNumber, "Week number matches for " + dateString);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ function populateCalendarsSection() {
|
|||
let tableTmpl = document.getElementById("calendars-table-template");
|
||||
let rowTmpl = document.getElementById("calendars-table-row-template");
|
||||
|
||||
for (let calendar of cal.getCalendarManager().getCalendars()) {
|
||||
for (let calendar of cal.manager.getCalendars()) {
|
||||
let table = tableTmpl.content.cloneNode(true).querySelector("table");
|
||||
table.firstElementChild.textContent = calendar.name;
|
||||
|
||||
|
|
|
@ -2612,10 +2612,7 @@ var gAccountSetup = {
|
|||
// Collect existing calendars to compare with the list of recently fetched
|
||||
// ones.
|
||||
let existing = new Set(
|
||||
cal
|
||||
.getCalendarManager()
|
||||
.getCalendars({})
|
||||
.map(calendar => calendar.uri.spec)
|
||||
cal.manager.getCalendars({}).map(calendar => calendar.uri.spec)
|
||||
);
|
||||
|
||||
let calendarsCount = 0;
|
||||
|
@ -2764,7 +2761,7 @@ var gAccountSetup = {
|
|||
* @param {calICalendar} calendar - The calendar to configure.
|
||||
*/
|
||||
_setupCalendar(button, calendar) {
|
||||
cal.getCalendarManager().registerCalendar(calendar);
|
||||
cal.manager.registerCalendar(calendar);
|
||||
|
||||
// Update the button to reflect the creation of the new calendar.
|
||||
button.classList.add("existing");
|
||||
|
|
|
@ -809,17 +809,16 @@ add_task(async function test_full_account_setup() {
|
|||
);
|
||||
|
||||
// Connect the linked calendar.
|
||||
let calendarManager = cal.getCalendarManager();
|
||||
let calendarPromise = new Promise(resolve => {
|
||||
let observer = {
|
||||
onCalendarRegistered(calendar) {
|
||||
calendarManager.removeObserver(this);
|
||||
cal.manager.removeObserver(this);
|
||||
resolve(calendar);
|
||||
},
|
||||
onCalendarUnregistering() {},
|
||||
onCalendarDeleting() {},
|
||||
};
|
||||
calendarManager.addObserver(observer);
|
||||
cal.manager.addObserver(observer);
|
||||
});
|
||||
|
||||
let calendarDialogShowed = BrowserTestUtils.waitForCondition(
|
||||
|
@ -887,7 +886,7 @@ add_task(async function test_full_account_setup() {
|
|||
|
||||
// Remove the address book and calendar.
|
||||
MailServices.ab.deleteAddressBook(abDirectory.URI);
|
||||
calendarManager.removeCalendar(calendar);
|
||||
cal.manager.removeCalendar(calendar);
|
||||
|
||||
// Restore the original pref.
|
||||
Services.prefs.setCharPref(PREF_NAME, PREF_VALUE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче