Bug 1557504 - remove [array] use in xpidl from calIItemBase.idl and calIAlarm.idl. r=pmorris

This commit is contained in:
Khushil Mistry 2019-11-14 21:19:51 +05:30
Родитель 28a3c65e22
Коммит 099a43dd6d
45 изменённых файлов: 229 добавлений и 284 удалений

Просмотреть файл

@ -901,7 +901,7 @@ agendaListbox.calendarObserver.getOccurrencesBetween = function(aItem) {
let start = this.agendaListbox.getStart();
let end = this.agendaListbox.getEnd();
if (start && end) {
occs = aItem.getOccurrencesBetween(start, end, {});
occs = aItem.getOccurrencesBetween(start, end);
}
return occs;
};

Просмотреть файл

@ -53,11 +53,7 @@
}
}
const occs = item.getOccurrencesBetween(
this.calView.startDate,
this.calView.queryEndDate,
{}
);
const occs = item.getOccurrencesBetween(this.calView.startDate, this.calView.queryEndDate);
for (const occ of occs) {
if (cal.item.isToDo(occ)) {
this.calView.doAddItem(occ.QueryInterface(Ci.calITodo));
@ -72,11 +68,7 @@
return;
}
if (!cal.item.isToDo(oldItem) || oldItem.entryDate || oldItem.dueDate) {
let occs = oldItem.getOccurrencesBetween(
this.calView.startDate,
this.calView.queryEndDate,
{}
);
let occs = oldItem.getOccurrencesBetween(this.calView.startDate, this.calView.queryEndDate);
for (const occ of occs) {
if (cal.item.isToDo(occ)) {
this.calView.doDeleteItem(occ.QueryInterface(Ci.calITodo));
@ -94,11 +86,7 @@
}
}
let occs = newItem.getOccurrencesBetween(
this.calView.startDate,
this.calView.queryEndDate,
{}
);
let occs = newItem.getOccurrencesBetween(this.calView.startDate, this.calView.queryEndDate);
for (const occ of occs) {
if (cal.item.isToDo(occ)) {
this.calView.doAddItem(occ.QueryInterface(Ci.calITodo));
@ -121,11 +109,7 @@
}
}
const occs = item.getOccurrencesBetween(
this.calView.startDate,
this.calView.queryEndDate,
{}
);
const occs = item.getOccurrencesBetween(this.calView.startDate, this.calView.queryEndDate);
for (const occ of occs) {
if (cal.item.isToDo(occ)) {
this.calView.doDeleteItem(occ.QueryInterface(Ci.calITodo));

Просмотреть файл

@ -209,7 +209,7 @@ function pasteFromClipboard() {
// we only will need to ask whether to send notifications, if there
// are attendees at all
let withAttendees = items.filter(aItem => aItem.getAttendees({}).length > 0);
let withAttendees = items.filter(aItem => aItem.getAttendees().length > 0);
let notify = Ci.calIItipItem.USER;
let destCal = null;
@ -295,7 +295,7 @@ function pasteFromClipboard() {
}
let extResp = { responseMode: Ci.calIItipItem.NONE };
if (item.getAttendees({}).length > 0) {
if (item.getAttendees().length > 0) {
extResp.responseMode = notify;
}

Просмотреть файл

@ -510,7 +510,7 @@ var calendarController = {
// If we are the organizer and there are attendees, then
// this is likely also an invitation.
let calOrgId = item.calendar.getProperty("organizerId");
if (item.organizer.id == calOrgId && item.getAttendees({}).length) {
if (item.organizer.id == calOrgId && item.getAttendees().length) {
selected_events_invitation++;
}
}
@ -651,7 +651,7 @@ var calendarController = {
// If we are the organizer and there are attendees, then
// this is likely also an invitation.
let calOrgId = item.calendar.getProperty("organizerId");
if (item.organizer.id == calOrgId && item.getAttendees({}).length) {
if (item.organizer.id == calOrgId && item.getAttendees().length) {
selected_tasks_invitation++;
}
}

Просмотреть файл

@ -70,14 +70,14 @@ var itemConversion = {
}
// Attendees
let attendees = aItem.getAttendees({});
let attendees = aItem.getAttendees();
for (let attendee of attendees) {
aTarget.addAttendee(attendee.clone());
}
// Categories
let categories = aItem.getCategories({});
aTarget.setCategories(categories.length, categories);
let categories = aItem.getCategories();
aTarget.setCategories(categories);
// Organizer
aTarget.organizer = aItem.organizer ? aItem.organizer.clone() : null;
@ -111,7 +111,7 @@ var itemConversion = {
item.dueDate = aEvent.endDate.clone();
// Alarms
for (let alarm of aEvent.getAlarms({})) {
for (let alarm of aEvent.getAlarms()) {
item.addAlarm(alarm.clone());
}
item.alarmLastAck = aEvent.alarmLastAck ? aEvent.alarmLastAck.clone() : null;
@ -162,7 +162,7 @@ var itemConversion = {
}
// Alarms
for (let alarm of aTask.getAlarms({})) {
for (let alarm of aTask.getAlarms()) {
item.addAlarm(alarm.clone());
}
item.alarmLastAck = aTask.alarmLastAck ? aTask.alarmLastAck.clone() : null;
@ -408,7 +408,7 @@ calMailButtonDNDObserver.prototype = {
if (aItems && aItems.length > 0) {
let item = aItems[0];
let identity = item.calendar.getProperty("imip.identity");
let parties = item.getAttendees({});
let parties = item.getAttendees();
if (item.organizer) {
parties.push(item.organizer);
}

Просмотреть файл

@ -298,7 +298,7 @@
let cssSafeId = cal.view.formatStringForCSSRule(item.calendar.id);
this.style.setProperty("--item-backcolor", `var(--calendar-${cssSafeId}-backcolor)`);
this.style.setProperty("--item-forecolor", `var(--calendar-${cssSafeId}-forecolor)`);
let categoriesArray = item.getCategories({});
let categoriesArray = item.getCategories();
if (categoriesArray.length > 0) {
let cssClassesArray = categoriesArray.map(cal.view.formatStringForCSSRule);
this.setAttribute("categories", cssClassesArray.join(" "));
@ -307,7 +307,7 @@
}
// Add alarm icons as needed.
let alarms = item.getAlarms({});
let alarms = item.getAlarms();
if (alarms.length && Services.prefs.getBoolPref("calendar.alarms.indicator.show", true)) {
let iconsBox = this.querySelector(".alarm-icons-box");
cal.alarms.addReminderImages(iconsBox, alarms);

Просмотреть файл

@ -765,7 +765,7 @@ function setContextPartstat(aTarget, aItems) {
let party = null;
if (cal.itip.isInvitation(aItem)) {
party = cal.itip.getInvitedAttendee(aItem);
} else if (aItem.organizer && aItem.getAttendees({}).length) {
} else if (aItem.organizer && aItem.getAttendees().length) {
let calOrgId = aItem.calendar.getProperty("organizerId");
if (calOrgId.toLowerCase() == aItem.organizer.id.toLowerCase()) {
party = aItem.organizer;

Просмотреть файл

@ -908,7 +908,7 @@
let occs = [];
if (item.recurrenceInfo) {
// If selected a parent item, show occurrence(s) in view range.
occs = item.getOccurrencesBetween(this.startDate, this.queryEndDate, {}, 0);
occs = item.getOccurrencesBetween(this.startDate, this.queryEndDate);
} else {
occs = [item];
}
@ -1007,7 +1007,7 @@
getItemOccurrencesInView(item) {
if (item.recurrenceInfo && item.recurrenceStartDate) {
// If a parent item is selected, show occurrence(s) in view range.
return item.getOccurrencesBetween(this.startDate, this.queryEndDate, {}, 0);
return item.getOccurrencesBetween(this.startDate, this.queryEndDate);
} else if (item.recurrenceStartDate) {
return [item];
}

Просмотреть файл

@ -242,12 +242,12 @@ class CalendarTaskTreeView {
}
// Alarm status atom.
if (item.getAlarms({}).length) {
if (item.getAlarms().length) {
properties.push("alarm");
}
// Task categories.
properties = properties.concat(item.getCategories({}).map(cal.view.formatStringForCSSRule));
properties = properties.concat(item.getCategories().map(cal.view.formatStringForCSSRule));
return properties.join(" ");
}
@ -311,7 +311,7 @@ class CalendarTaskTreeView {
return task.percentComplete > 0 ? task.percentComplete + "%" : "";
case "categories":
// TODO This is l10n-unfriendly.
return task.getCategories({}).join(", ");
return task.getCategories().join(", ");
case "location":
return task.getProperty("LOCATION");
case "status":

Просмотреть файл

@ -123,7 +123,7 @@ var taskDetailsView = {
}
}
}
let categories = item.getCategories({});
let categories = item.getCategories();
if (
!document
.getElementById("calendar-task-details-category-row")
@ -174,7 +174,7 @@ var taskDetailsView = {
textbox.readOnly = true;
let attachmentRows = document.getElementById("calendar-task-details-attachment-rows");
removeChildren(attachmentRows);
let attachments = item.getAttachments({});
let attachments = item.getAttachments();
if (displayElement("calendar-task-details-attachment-row", attachments.length > 0)) {
displayElement("calendar-task-details-attachment-rows", true);
for (let attachment of attachments) {
@ -196,7 +196,7 @@ var taskDetailsView = {
let categoryPopup = document.getElementById("task-actions-category-popup");
let item = document.getElementById("calendar-task-tree").currentTask;
let itemCategories = item.getCategories({});
let itemCategories = item.getCategories();
let categoryList = cal.category.fromPrefs();
for (let cat of itemCategories) {
if (!categoryList.includes(cat)) {
@ -237,7 +237,7 @@ var taskDetailsView = {
let categoryPopup = document.getElementById("task-actions-category-popup");
let item = document.getElementById("calendar-task-tree").currentTask;
let oldCategories = item.getCategories({});
let oldCategories = item.getCategories();
let categories = Array.from(
categoryPopup.querySelectorAll("menuitem.calendar-category[checked]"),
menuitem => menuitem.value
@ -249,7 +249,7 @@ var taskDetailsView = {
if (!unchanged) {
let newItem = item.clone();
newItem.setCategories(categories.length, categories);
newItem.setCategories(categories);
doTransaction("modify", newItem, newItem.calendar, item, null);
return false;
}
@ -337,7 +337,7 @@ var taskDetailsView = {
let item = document.getElementById("calendar-task-tree").currentTask;
let newItem = item.clone();
newItem.setCategories(categories.length, categories);
newItem.setCategories(categories);
doTransaction("modify", newItem, newItem.calendar, item, null);
}

Просмотреть файл

@ -674,7 +674,7 @@ function setupAttendanceMenu(aMenu, aItems) {
let party = null;
if (cal.itip.isInvitation(aItem)) {
party = cal.itip.getInvitedAttendee(aItem);
} else if (aItem.organizer && aItem.getAttendees({}).length) {
} else if (aItem.organizer && aItem.getAttendees().length) {
let calOrgId = aItem.calendar.getProperty("organizerId");
if (calOrgId && calOrgId.toLowerCase() == aItem.organizer.id.toLowerCase()) {
party = aItem.organizer;

Просмотреть файл

@ -148,7 +148,7 @@ var unifinderObserver = {
let filter = unifinderTreeView.mFilter;
if (filter.startDate && filter.endDate) {
items = aItem.getOccurrencesBetween(filter.startDate, filter.endDate, {});
items = aItem.getOccurrencesBetween(filter.startDate, filter.endDate);
} else {
items = [aItem];
}
@ -166,7 +166,7 @@ var unifinderObserver = {
let items;
let filter = unifinderTreeView.mFilter;
if (filter.startDate && filter.endDate && aItem.parentItem == aItem) {
items = aItem.getOccurrencesBetween(filter.startDate, filter.endDate, {});
items = aItem.getOccurrencesBetween(filter.startDate, filter.endDate);
} else {
items = [aItem];
}
@ -722,12 +722,12 @@ var unifinderTreeView = {
}
// Alarm status atom
if (item.getAlarms({}).length) {
if (item.getAlarms().length) {
properties.push("alarm");
}
// Task categories
properties = properties.concat(item.getCategories({}).map(cal.view.formatStringForCSSRule));
properties = properties.concat(item.getCategories().map(cal.view.formatStringForCSSRule));
return properties.join(" ");
},
@ -798,7 +798,7 @@ var unifinderTreeView = {
return formatUnifinderEventDateTime(eventEndDate);
}
case "categories": {
return calendarEvent.getCategories({}).join(", ");
return calendarEvent.getCategories().join(", ");
}
case "location": {
return calendarEvent.getProperty("LOCATION");

Просмотреть файл

@ -302,7 +302,7 @@ function saveReminder(item) {
// We want to compare the old alarms with the new ones. If these are not
// the same, then clear the snooze/dismiss times
let oldAlarmMap = {};
for (let alarm of item.getAlarms({})) {
for (let alarm of item.getAlarms()) {
oldAlarmMap[alarm.icalString] = true;
}
@ -338,7 +338,7 @@ function saveReminder(item) {
}
// Compare alarms to see if something changed.
for (let alarm of item.getAlarms({})) {
for (let alarm of item.getAlarms()) {
let ics = alarm.icalString;
if (ics in oldAlarmMap) {
// The new alarm is also in the old set, remember this
@ -709,7 +709,7 @@ function adaptScheduleAgent(aItem) {
// for attendees, we change schedule-agent only in case of an
// organizer triggered action
if (organizerAction) {
aItem.getAttendees({}).forEach(aAttendee => {
aItem.getAttendees().forEach(aAttendee => {
// overwriting must always happen consistently for all
// attendees regarding SERVER or CLIENT but must not override
// e.g. NONE, so we only overwrite if the param is set to
@ -735,7 +735,7 @@ function adaptScheduleAgent(aItem) {
aItem.organizer.deleteProperty("SCHEDULE-FORCE-SEND");
}
} else if (organizerAction) {
aItem.getAttendees({}).forEach(aAttendee => {
aItem.getAttendees().forEach(aAttendee => {
if (aAttendee.getProperty("SCHEDULE-AGENT") == "CLIENT") {
aAttendee.deleteProperty("SCHEDULE-AGENT");
}

Просмотреть файл

@ -85,7 +85,7 @@ function onLoad() {
function loadReminders() {
let args = window.arguments[0];
let listbox = document.getElementById("reminder-listbox");
let reminders = args.reminders || args.item.getAlarms({});
let reminders = args.reminders || args.item.getAlarms();
// This dialog should not be shown if the calendar doesn't support alarms at
// all, so the case of maxCount = 0 breaking this logic doesn't apply.

Просмотреть файл

@ -295,7 +295,7 @@ function fillJobQueue(queue) {
// set default alarm on unresponded items that have not been declined:
if (
!newCalendarItem.getAlarms({}).length &&
!newCalendarItem.getAlarms().length &&
oldStatus == "NEEDS-ACTION" &&
newStatus != "DECLINED"
) {

Просмотреть файл

@ -63,7 +63,7 @@ function onLoad() {
setDialogId(document.documentElement, "calendar-task-summary-dialog");
}
window.attendees = item.getAttendees({});
window.attendees = item.getAttendees();
let calendar = cal.wrapInstance(item.calendar, Ci.calISchedulingSupport);
window.readOnly = !(
@ -75,7 +75,7 @@ function onLoad() {
let attendee = calendar.getInvitedAttendee(item);
if (attendee) {
// if this is an unresponded invitation, preset our default alarm values:
if (!item.getAlarms({}).length && attendee.participationStatus == "NEEDS-ACTION") {
if (!item.getAlarms().length && attendee.participationStatus == "NEEDS-ACTION") {
cal.alarms.setDefaultValues(item);
}
@ -123,7 +123,7 @@ function onLoad() {
argCalendar.getProperty("capabilities.alarms.oninvitations.supported") !== false;
if (!window.readOnly && supportsReminders) {
document.getElementById("reminder-row").removeAttribute("hidden");
loadReminders(window.calendarItem.getAlarms({}));
loadReminders(window.calendarItem.getAlarms());
updateReminder();
}
@ -137,7 +137,7 @@ function onLoad() {
document.getElementById("item-location").value = location;
}
let categories = item.getCategories({});
let categories = item.getCategories();
if (categories.length > 0) {
document.getElementById("category-row").removeAttribute("hidden");
document.getElementById("item-category").value = categories.join(", "); // TODO l10n-unfriendly
@ -208,7 +208,7 @@ function onLoad() {
document.title = item.title;
let attachments = item.getAttachments({});
let attachments = item.getAttachments();
if (attachments.length) {
// we only want to display uri type attachments and no ones received inline with the
// invitation message (having a CID: prefix results in about:blank) here
@ -510,7 +510,7 @@ function openAttachment(aAttachmentId) {
let args = window.arguments[0];
let item = args.calendarEvent;
let attachments = item
.getAttachments({})
.getAttachments()
.filter(aAttachment => aAttachment.hashId == aAttachmentId);
if (attachments.length && attachments[0].uri && attachments[0].uri.spec != "about:blank") {
Cc["@mozilla.org/uriloader/external-protocol-service;1"]

Просмотреть файл

@ -317,7 +317,7 @@
setBusyDaysForItem(aItem, aState) {
let items = aItem.recurrenceInfo
? aItem.getOccurrencesBetween(this.firstDate, this.lastDate, {})
? aItem.getOccurrencesBetween(this.firstDate, this.lastDate)
: [aItem];
items.forEach(item => this.setBusyDaysForOccurrence(item, aState));
}

Просмотреть файл

@ -327,7 +327,7 @@ var calitip = {
} else {
let comparison;
for (let item of itipItem.getItemList()) {
let attendees = cal.itip.getAttendeesBySender(item.getAttendees({}), itipItem.sender);
let attendees = cal.itip.getAttendeesBySender(item.getAttendees(), itipItem.sender);
if (attendees.length == 1) {
comparison = calitip.compareSequence(item, foundItems[0]);
if (comparison == 1) {
@ -799,8 +799,8 @@ var calitip = {
);
}
} else if (
(aOriginalItem && aOriginalItem.getAttendees({}).length) ||
aItem.getAttendees({}).length
(aOriginalItem && aOriginalItem.getAttendees().length) ||
aItem.getAttendees().length
) {
// let's log something useful to notify addon developers or find any
// missing pieces in the conversions if the current or original item
@ -903,7 +903,7 @@ var calitip = {
}
// special handling for invitation with event status cancelled
if (aItem.getAttendees({}).length > 0 && aItem.getProperty("STATUS") == "CANCELLED") {
if (aItem.getAttendees().length > 0 && aItem.getProperty("STATUS") == "CANCELLED") {
if (calitip.getSequence(aItem) > 0) {
// make sure we send a cancellation and not an request
aOpType = Ci.calIOperationListener.DELETE;
@ -914,12 +914,12 @@ var calitip = {
}
if (aOpType == Ci.calIOperationListener.DELETE) {
sendMessage(aItem, "CANCEL", aItem.getAttendees({}), autoResponse);
sendMessage(aItem, "CANCEL", aItem.getAttendees(), autoResponse);
return;
} // else ADD, MODIFY:
let originalAtt = aOriginalItem ? aOriginalItem.getAttendees({}) : [];
let itemAtt = aItem.getAttendees({});
let originalAtt = aOriginalItem ? aOriginalItem.getAttendees() : [];
let itemAtt = aItem.getAttendees();
let canceledAttendees = [];
let addedAttendees = [];
@ -967,7 +967,7 @@ var calitip = {
// Fix up our attendees for invitations using some good defaults
let recipients = [];
let reqItemAtt = requestItem.getAttendees({});
let reqItemAtt = requestItem.getAttendees();
if (!isMinorUpdate) {
requestItem.removeAllAttendees();
}
@ -1312,7 +1312,7 @@ function stripUserData(item_) {
let lastModified = item.lastModifiedTime;
item.clearAlarms();
item.alarmLastAck = null;
item.setCategories(0, []);
item.setCategories([]);
item.deleteProperty("RECEIVED-SEQUENCE");
item.deleteProperty("RECEIVED-DTSTAMP");
for (let [name] of item.properties) {
@ -1321,7 +1321,7 @@ function stripUserData(item_) {
item.deleteProperty(name);
}
}
item.getAttendees({}).forEach(att => {
item.getAttendees().forEach(att => {
att.deleteProperty("RECEIVED-SEQUENCE");
att.deleteProperty("RECEIVED-DTSTAMP");
});
@ -1333,7 +1333,7 @@ function stripUserData(item_) {
aCalUser.deleteProperty("SCHEDULE-FORCE-SEND");
aCalUser.deleteProperty("SCHEDULE-STATUS");
};
item.getAttendees({}).forEach(removeSchedulingParams);
item.getAttendees().forEach(removeSchedulingParams);
if (item.organizer) {
removeSchedulingParams(item.organizer);
}
@ -1361,12 +1361,12 @@ function updateItem(item, itipItemItem) {
// preserve user settings:
newItem.generation = oldItem.generation;
newItem.clearAlarms();
for (let alarm of oldItem.getAlarms({})) {
for (let alarm of oldItem.getAlarms()) {
newItem.addAlarm(alarm);
}
newItem.alarmLastAck = oldItem.alarmLastAck;
let cats = oldItem.getCategories({});
newItem.setCategories(cats.length, cats);
let cats = oldItem.getCategories();
newItem.setCategories(cats);
}
let newItem = item.clone();
@ -1732,7 +1732,7 @@ ItipItemFinder.prototype = {
switch (method) {
case "REFRESH": {
// xxx todo test
let attendees = itipItemItem.getAttendees({});
let attendees = itipItemItem.getAttendees();
cal.ASSERT(attendees.length == 1, "invalid number of attendees in REFRESH!");
if (attendees.length > 0) {
let action = function(opListener, partStat, extResponse) {
@ -1756,7 +1756,7 @@ ItipItemFinder.prototype = {
}
case "PUBLISH":
cal.ASSERT(
itipItemItem.getAttendees({}).length == 0,
itipItemItem.getAttendees().length == 0,
"invalid number of attendees in PUBLISH!"
);
if (
@ -1847,7 +1847,7 @@ ItipItemFinder.prototype = {
break;
case "COUNTER":
case "REPLY": {
let attendees = itipItemItem.getAttendees({});
let attendees = itipItemItem.getAttendees();
if (method == "REPLY") {
cal.ASSERT(attendees.length == 1, "invalid number of attendees in REPLY!");
} else {
@ -1987,7 +1987,7 @@ ItipItemFinder.prototype = {
}
} else {
cal.ASSERT(
itipItemItem.getAttendees({}).length == 0,
itipItemItem.getAttendees().length == 0,
"invalid number of attendees in PUBLISH!"
);
cal.alarms.setDefaultValues(newItem);

Просмотреть файл

@ -54,7 +54,7 @@ var calprint = {
itemNode.querySelector(".item-title").textContent = item.title;
// Fill in category details
let categoriesArray = item.getCategories({});
let categoriesArray = item.getCategories();
if (categoriesArray.length > 0) {
let cssClassesArray = categoriesArray.map(cal.view.formatStringForCSSRule);
let categoriesBox = itemNode.querySelector(".category-color-box");

Просмотреть файл

@ -49,7 +49,7 @@ var calunifinder = {
return aItem.percentComplete;
case "categories":
return aItem.getCategories({}).join(", ");
return aItem.getCategories().join(", ");
case "location":
return aItem.getProperty("LOCATION") || "";

Просмотреть файл

@ -118,8 +118,7 @@ interface calIAlarm : nsISupports
void addAttendee(in calIAttendee aAttendee);
void deleteAttendee(in calIAttendee aAttendee);
void clearAttendees();
void getAttendees(out uint32_t count,
[array,size_is(count),retval] out calIAttendee attendees);
Array<calIAttendee> getAttendees();
/**
* Manage Attachments for this alarm.
@ -130,8 +129,7 @@ interface calIAlarm : nsISupports
void addAttachment(in calIAttachment aAttachment);
void deleteAttachment(in calIAttachment aAttachment);
void clearAttachments();
void getAttachments(out uint32_t count,
[array,size_is(count),retval] out calIAttachment attachments);
Array<calIAttachment> getAttachments();
/**
* The human readable representation of this alarm. Uses locale strings.

Просмотреть файл

@ -113,10 +113,9 @@ interface calIItemBase : nsISupports
/**
* Get all alarms assigned to this item
*
* @param count The number of alarms
* @param aAlarms The array of calIAlarms
*/
void getAlarms(out uint32_t count, [array, size_is(count), retval] out calIAlarm aAlarms);
Array<calIAlarm> getAlarms();
/**
* Add an alarm to the item
@ -260,8 +259,7 @@ interface calIItemBase : nsISupports
// The array returned here is not live; it will not reflect calls to
// removeAttendee/addAttendee that follow the call to getAttendees.
void getAttendees(out uint32_t count,
[array,size_is(count),retval] out calIAttendee attendees);
Array<calIAttendee> getAttendees();
/**
* getAttendeeById's matching is done in a case-insensitive manner to handle
@ -276,8 +274,7 @@ interface calIItemBase : nsISupports
//
// Attachments
//
void getAttachments(out uint32_t count,
[array,size_is(count),retval] out calIAttachment attachments);
Array<calIAttachment> getAttachments();
void addAttachment(in calIAttachment attachment);
void removeAttachment(in calIAttachment attachment);
void removeAllAttachments();
@ -289,14 +286,12 @@ interface calIItemBase : nsISupports
/**
* Gets the array of categories this item belongs to.
*/
void getCategories(out uint32_t aCount,
[array, size_is(aCount), retval] out wstring aCategories);
Array<AString> getCategories();
/**
* Sets the array of categories this item belongs to.
*/
void setCategories(in uint32_t aCount,
[array, size_is(aCount)] in wstring aCategories);
void setCategories(in Array<AString> aCategories);
//
// Relations
@ -306,8 +301,7 @@ interface calIItemBase : nsISupports
* This gives back every relation where the item is neither the owner of the
* relation nor the referred relation
*/
void getRelations(out uint32_t count,
[array,size_is(count),retval] out calIRelation relations);
Array<calIRelation> getRelations();
/**
* Adds a relation to the item
@ -331,9 +325,7 @@ interface calIItemBase : nsISupports
* Return a list of occurrences of this item between the given dates. The items
* returned are the same type as this one, as proxies.
*/
void getOccurrencesBetween (in calIDateTime aStartDate, in calIDateTime aEndDate,
out uint32_t aCount,
[array,size_is(aCount),retval] out calIItemBase aOccurrences);
Array<calIItemBase> getOccurrencesBetween(in calIDateTime aStartDate, in calIDateTime aEndDate);
/**
* If this item is a proxy or overridden item, parentItem will point upwards

Просмотреть файл

@ -251,14 +251,13 @@ calAlarm.prototype = {
return alarmDate;
},
getAttendees: function(aCount) {
getAttendees: function() {
let attendees;
if (this.action == "AUDIO" || this.action == "DISPLAY") {
attendees = [];
} else {
attendees = this.mAttendees.concat([]);
}
aCount.value = attendees.length;
return attendees;
},
@ -289,7 +288,7 @@ calAlarm.prototype = {
this.mAttendees = [];
},
getAttachments: function(aCount) {
getAttachments: function() {
let attachments;
if (this.action == "AUDIO") {
attachments = this.mAttachments.length ? [this.mAttachments[0]] : [];
@ -298,7 +297,6 @@ calAlarm.prototype = {
} else {
attachments = this.mAttachments.concat([]);
}
aCount.value = attachments.length;
return attachments;
},
@ -396,10 +394,10 @@ calAlarm.prototype = {
// Set up attendees (REQUIRED for EMAIL action)
/* TODO should we be strict here?
if (this.action == "EMAIL" && !this.getAttendees({}).length) {
if (this.action == "EMAIL" && !this.getAttendees().length) {
throw Cr.NS_ERROR_NOT_INITIALIZED;
} */
for (let attendee of this.getAttendees({})) {
for (let attendee of this.getAttendees()) {
comp.addProperty(attendee.icalProperty);
}
@ -408,7 +406,7 @@ calAlarm.prototype = {
throw Cr.NS_ERROR_NOT_INITIALIZED;
} */
for (let attachment of this.getAttachments({})) {
for (let attachment of this.getAttachments()) {
comp.addProperty(attachment.icalProperty);
}

Просмотреть файл

@ -319,7 +319,7 @@ calAlarmService.prototype = {
let showMissed = Services.prefs.getBoolPref("calendar.alarms.showmissed", true);
let alarms = aItem.getAlarms({});
let alarms = aItem.getAlarms();
for (let alarm of alarms) {
let alarmDate = cal.alarms.calculateAlarmDate(aItem, alarm);
@ -401,7 +401,7 @@ calAlarmService.prototype = {
// make sure already fired alarms are purged out of the alarm window:
this.mObservers.notify("onRemoveAlarmsByItem", [aItem]);
// Purge alarms specifically for this item (i.e exception)
for (let alarm of aItem.getAlarms({})) {
for (let alarm of aItem.getAlarms()) {
this.removeTimer(aItem, alarm);
}
},

Просмотреть файл

@ -387,7 +387,7 @@ calFilter.prototype = {
}
}
return aItem.getCategories({}).some(cat => cat.toLowerCase().includes(searchText));
return aItem.getCategories().some(cat => cat.toLowerCase().includes(searchText));
},
/**
@ -443,7 +443,7 @@ calFilter.prototype = {
} else if (Array.isArray(props.category)) {
cats = props.category;
}
result = cats.some(cat => aItem.getCategories({}).includes(cat));
result = cats.some(cat => aItem.getCategories().includes(cat));
}
// test the status property. Only applies to tasks.
@ -852,8 +852,7 @@ calFilter.prototype = {
} else {
occs = aItem.getOccurrencesBetween(
this.mStartDate || cal.createDateTime(),
this.mEndDate || cal.dtz.now(),
{}
this.mEndDate || cal.dtz.now()
);
if (props.occurrences == props.FILTER_OCCURRENCES_PAST_AND_NEXT && !this.mEndDate) {
// we have an unbound date range and the occurrence filter specifies

Просмотреть файл

@ -273,7 +273,7 @@ calItemBase.prototype = {
cloned.mOrganizer = org;
cloned.mAttendees = [];
for (let att of this.getAttendees({})) {
for (let att of this.getAttendees()) {
cloned.mAttendees.push(att.clone());
}
@ -296,19 +296,19 @@ calItemBase.prototype = {
}
cloned.mAttachments = [];
for (let att of this.getAttachments({})) {
for (let att of this.getAttachments()) {
cloned.mAttachments.push(att.clone());
}
cloned.mRelations = [];
for (let rel of this.getRelations({})) {
for (let rel of this.getRelations()) {
cloned.mRelations.push(rel.clone());
}
cloned.mCategories = this.getCategories({});
cloned.mCategories = this.getCategories();
cloned.mAlarms = [];
for (let alarm of this.getAlarms({})) {
for (let alarm of this.getAlarms()) {
// Clone alarms into new item, assume the alarms from the old item
// are valid and don't need validation.
cloned.mAlarms.push(alarm.clone());
@ -483,22 +483,20 @@ calItemBase.prototype = {
// void getAttendees(out PRUint32 count,
// [array,size_is(count),retval] out calIAttendee attendees);
getAttendees: function(countObj) {
getAttendees: function() {
if (!this.mAttendees && this.mIsProxy) {
this.mAttendees = this.mParentItem.getAttendees(countObj);
this.mAttendees = this.mParentItem.getAttendees();
}
if (this.mAttendees) {
countObj.value = this.mAttendees.length;
return this.mAttendees.concat([]); // clone
} else {
countObj.value = 0;
return [];
}
},
// calIAttendee getAttendeeById(in AUTF8String id);
getAttendeeById: function(id) {
let attendees = this.getAttendees({});
let attendees = this.getAttendees();
let lowerCaseId = id.toLowerCase();
for (let attendee of attendees) {
// This match must be case insensitive to deal with differing
@ -515,7 +513,7 @@ calItemBase.prototype = {
this.modify();
let found = false,
newAttendees = [];
let attendees = this.getAttendees({});
let attendees = this.getAttendees();
let attIdLowerCase = attendee.id.toLowerCase();
for (let i = 0; i < attendees.length; i++) {
@ -574,22 +572,19 @@ calItemBase.prototype = {
}
}
this.modify();
this.mAttendees = this.getAttendees({});
this.mAttendees = this.getAttendees();
this.mAttendees.push(attendee);
}
},
// void getAttachments(out PRUint32 count,
// [array,size_is(count),retval] out calIAttachment attachments);
getAttachments: function(aCount) {
// Array<calIAttachment> getAttachments();
getAttachments: function() {
if (!this.mAttachments && this.mIsProxy) {
this.mAttachments = this.mParentItem.getAttachments(aCount);
this.mAttachments = this.mParentItem.getAttachments();
}
if (this.mAttachments) {
aCount.value = this.mAttachments.length;
return this.mAttachments.concat([]); // clone
} else {
aCount.value = 0;
return [];
}
},
@ -609,7 +604,7 @@ calItemBase.prototype = {
// void addAttachment(in calIAttachment attachment);
addAttachment: function(attachment) {
this.modify();
this.mAttachments = this.getAttachments({});
this.mAttachments = this.getAttachments();
if (!this.mAttachments.some(x => x.hashId == attachment.hashId)) {
this.mAttachments.push(attachment);
}
@ -621,17 +616,14 @@ calItemBase.prototype = {
this.mAttachments = [];
},
// void getRelations(out PRUint32 count,
// [array,size_is(count),retval] out calIRelation relations);
getRelations: function(aCount) {
// Array<calIRelation> getRelations();
getRelations: function() {
if (!this.mRelations && this.mIsProxy) {
this.mRelations = this.mParentItem.getRelations(aCount);
this.mRelations = this.mParentItem.getRelations();
}
if (this.mRelations) {
aCount.value = this.mRelations.length;
return this.mRelations.concat([]);
} else {
aCount.value = 0;
return [];
}
},
@ -655,7 +647,7 @@ calItemBase.prototype = {
// void addRelation(in calIRelation relation);
addRelation: function(aRelation) {
this.modify();
this.mRelations = this.getRelations({});
this.mRelations = this.getRelations();
this.mRelations.push(aRelation);
// XXX ensure that the relation isn't already there?
},
@ -695,24 +687,20 @@ calItemBase.prototype = {
this.mOrganizer = organizer;
},
// void getCategories(out PRUint32 aCount,
// [array, size_is(aCount), retval] out wstring aCategories);
getCategories: function(aCount) {
// Array<AString> getCategories();
getCategories: function() {
if (!this.mCategories && this.mIsProxy) {
this.mCategories = this.mParentItem.getCategories(aCount);
this.mCategories = this.mParentItem.getCategories();
}
if (this.mCategories) {
aCount.value = this.mCategories.length;
return this.mCategories.concat([]); // clone
} else {
aCount.value = 0;
return [];
}
},
// void setCategories(in PRUint32 aCount,
// [array, size_is(aCount)] in wstring aCategories);
setCategories: function(aCount, aCategories) {
// void setCategories(in Array<AString> aCategories);
setCategories: function(aCategories) {
this.modify();
this.mCategories = aCategories.concat([]);
},
@ -968,15 +956,15 @@ calItemBase.prototype = {
icalcomp.addProperty(org.icalProperty);
}
for (let attendee of this.getAttendees({})) {
for (let attendee of this.getAttendees()) {
icalcomp.addProperty(attendee.icalProperty);
}
for (let attachment of this.getAttachments({})) {
for (let attachment of this.getAttachments()) {
icalcomp.addProperty(attachment.icalProperty);
}
for (let relation of this.getRelations({})) {
for (let relation of this.getRelations()) {
icalcomp.addProperty(relation.icalProperty);
}
@ -986,7 +974,7 @@ calItemBase.prototype = {
}
}
for (let cat of this.getCategories({})) {
for (let cat of this.getCategories()) {
let catprop = icssvc.createIcalProperty("CATEGORIES");
catprop.value = cat;
icalcomp.addProperty(catprop);
@ -1007,20 +995,14 @@ calItemBase.prototype = {
}
},
// void getAlarms(out PRUint32 count, [array, size_is(count), retval] out calIAlarm aAlarms);
getAlarms: function(aCount) {
if (typeof aCount != "object") {
throw Cr.NS_ERROR_XPC_NEED_OUT_OBJECT;
}
// Array<calIAlarm> getAlarms();
getAlarms: function() {
if (!this.mAlarms && this.mIsProxy) {
this.mAlarms = this.mParentItem.getAlarms(aCount);
this.mAlarms = this.mParentItem.getAlarms();
}
if (this.mAlarms) {
aCount.value = this.mAlarms.length;
return this.mAlarms.concat([]); // clone
} else {
aCount.value = 0;
return [];
}
},
@ -1044,14 +1026,14 @@ calItemBase.prototype = {
}
this.modify();
this.mAlarms = this.getAlarms({});
this.mAlarms = this.getAlarms();
this.mAlarms.push(aAlarm);
},
// void deleteAlarm(in calIAlarm aAlarm);
deleteAlarm: function(aAlarm) {
this.modify();
this.mAlarms = this.getAlarms({});
this.mAlarms = this.getAlarms();
for (let i = 0; i < this.mAlarms.length; i++) {
if (cal.data.compareObjects(this.mAlarms[i], aAlarm, Ci.calIAlarm)) {
this.mAlarms.splice(i, 1);
@ -1066,20 +1048,16 @@ calItemBase.prototype = {
this.mAlarms = [];
},
// void getOccurrencesBetween (in calIDateTime aStartDate, in calIDateTime aEndDate,
// out PRUint32 aCount,
// [array,size_is(aCount),retval] out calIItemBase aOccurrences);
getOccurrencesBetween: function(aStartDate, aEndDate, aCount) {
// Array<calIItemBase> getOccurrencesBetween(in calIDateTime aStartDate, in calIDateTime aEndDate);
getOccurrencesBetween: function(aStartDate, aEndDate) {
if (this.recurrenceInfo) {
return this.recurrenceInfo.getOccurrences(aStartDate, aEndDate, 0, aCount);
return this.recurrenceInfo.getOccurrences(aStartDate, aEndDate, 0, {});
}
if (cal.item.checkIfInRange(this, aStartDate, aEndDate)) {
aCount.value = 1;
return [this];
}
aCount.value = 0;
return [];
},
};

Просмотреть файл

@ -109,7 +109,7 @@ calItipItem.prototype = {
}
}
// never publish an organizer's RECEIVED params:
item.getAttendees({}).forEach(att => {
item.getAttendees().forEach(att => {
att.deleteProperty("RECEIVED-SEQUENCE");
att.deleteProperty("RECEIVED-DTSTAMP");
});
@ -121,7 +121,7 @@ calItipItem.prototype = {
aCalUser.deleteProperty("SCHEDULE-FORCE-SEND");
aCalUser.deleteProperty("SCHEDULE-STATUS");
};
item.getAttendees({}).forEach(removeSchedulingParams);
item.getAttendees().forEach(removeSchedulingParams);
// we're graceful here as some PUBLISHed events may violate RfC by having no organizer
if (item.organizer) {
removeSchedulingParams(item.organizer);

Просмотреть файл

@ -376,7 +376,7 @@ calOutlookCSVImporter.prototype = {
txt = this.parseTextField(eventFields[args.categoriesIndex]);
if (txt) {
let categories = cal.category.stringToArray(txt);
event.setCategories(categories.length, categories);
event.setCategories(categories);
}
}
if ("locationIndex" in args) {
@ -498,14 +498,14 @@ calOutlookCSVExporter.prototype = {
line.push(timeString(item.endDate));
line.push(item.startDate.isDate ? localeEn.valueTrue : localeEn.valueFalse);
let alarmDate;
let alarms = item.getAlarms({});
let alarms = item.getAlarms();
if (alarms.length) {
alarmDate = cal.alarms.calculateAlarmDate(item, alarms[0]);
}
line.push(alarmDate ? localeEn.valueTrue : localeEn.valueFalse);
line.push(alarmDate ? dateString(alarmDate) : "");
line.push(alarmDate ? timeString(alarmDate) : "");
line.push(txtString(cal.category.arrayToString(item.getCategories({})))); // xxx todo: what's the correct way to encode ',' in csv?, how are multi-values expressed?
line.push(txtString(cal.category.arrayToString(item.getCategories()))); // xxx todo: what's the correct way to encode ',' in csv?, how are multi-values expressed?
line.push(txtString(item.getProperty("DESCRIPTION")));
line.push(txtString(item.getProperty("LOCATION")));
line.push(item.privacy == "PRIVATE" ? localeEn.valueTrue : localeEn.valueFalse);

Просмотреть файл

@ -361,7 +361,7 @@ var ltnImipBar = {
// already, the checks have been done in cal.itip.processFoundItems
// when setting up the respective aActionFunc
let attendees = cal.itip.getAttendeesBySender(
aItem.getAttendees({}),
aItem.getAttendees(),
aItipItem.sender
);
let status = true;
@ -437,7 +437,7 @@ var ltnImipBar = {
}
let parsedProposal = ltn.invitation.parseCounter(proposedItem, item);
let potentialProposers = cal.itip.getAttendeesBySender(
proposedItem.getAttendees({}),
proposedItem.getAttendees(),
ltnImipBar.itipItem.sender
);
let proposingAttendee = potentialProposers.length == 1 ? potentialProposers[0] : null;

Просмотреть файл

@ -387,7 +387,7 @@ function onLoad() {
// clone each existing attendee since we still suffer
// from the 'lost x-properties'-bug.
window.attendees = [];
let attendees = item.getAttendees({});
let attendees = item.getAttendees();
if (attendees && attendees.length) {
for (let attendee of attendees) {
window.attendees.push(attendee.clone());
@ -397,7 +397,7 @@ function onLoad() {
window.organizer = null;
if (item.organizer) {
window.organizer = item.organizer.clone();
} else if (item.getAttendees({}).length > 0) {
} else if (item.getAttendees().length > 0) {
// previous versions of calendar may have filled ORGANIZER correctly on overridden instances:
let orgId = item.calendar.getProperty("organizerId");
if (orgId) {
@ -663,7 +663,7 @@ function loadDialog(aItem) {
if (gNewItemUI) {
// XXX more to do here with localization, see loadCategories.
itemProps.initialCategoriesList = cal.l10n.sortArrayByLocaleCollator(cal.category.fromPrefs());
itemProps.initialCategories = aItem.getCategories({});
itemProps.initialCategories = aItem.getCategories();
// just to demo capsules component
itemProps.initialCategories = ["Some", "Demo", "Categories"];
@ -676,7 +676,7 @@ function loadDialog(aItem) {
loadCloudProviders();
}
let hasAttachments = capSupported("attachments");
let attachments = aItem.getAttachments({});
let attachments = aItem.getAttachments();
if (gNewItemUI) {
itemProps.initialAttachments = {};
}
@ -786,7 +786,7 @@ function loadDialog(aItem) {
if (!gNewItemUI) {
// load reminders details
loadReminders(aItem.getAlarms({}));
loadReminders(aItem.getAlarms());
// Synchronize link-top-image with keep-duration-button status
let keepAttribute =
@ -909,7 +909,7 @@ function changeUndiscloseCheckboxStatus() {
* @param aItem The item to load into the category panel
*/
function loadCategories(aItem) {
let itemCategories = aItem.getCategories({});
let itemCategories = aItem.getCategories();
let categoryList = cal.category.fromPrefs();
for (let cat of itemCategories) {
if (!categoryList.includes(cat)) {
@ -1076,7 +1076,7 @@ function saveCategories(aItem) {
categoryPopup.querySelectorAll("menuitem.calendar-category[checked]"),
cat => cat.getAttribute("label")
);
aItem.setCategories(categoryList.length, categoryList);
aItem.setCategories(categoryList);
}
/**

Просмотреть файл

@ -37,7 +37,7 @@ ltn.invitation = {
case "COUNTER":
// falls through
case "REPLY": {
let attendees = item.getAttendees({});
let attendees = item.getAttendees();
let sender = cal.itip.getAttendeesBySender(attendees, aItipItem.sender);
if (sender.length == 1) {
if (aItipItem.responseMethod == "COUNTER") {
@ -212,7 +212,7 @@ ltn.invitation = {
// ATTACH - we only display URI but no BINARY type attachments here
let links = [];
let attachments = aEvent.getAttachments({});
let attachments = aEvent.getAttachments();
for (let attachment of attachments) {
if (attachment.uri) {
links.push(attachment.uri.spec);
@ -221,7 +221,7 @@ ltn.invitation = {
field("attachments", links.join("<br>"), true);
// ATTENDEE and ORGANIZER fields
let attendees = aEvent.getAttendees({});
let attendees = aEvent.getAttendees();
let attendeeTemplate = doc.getElementById("attendee-template");
let attendeeTable = doc.getElementById("attendee-table");
let organizerTable = doc.getElementById("organizer-table");

Просмотреть файл

@ -2875,7 +2875,7 @@ calDavCalendar.prototype = {
}
let newItem = itemToUpdate.clone();
for (let attendee of aItem.getAttendees({})) {
for (let attendee of aItem.getAttendees()) {
let att = newItem.getAttendeeById(attendee.id);
if (att) {
newItem.removeAttendee(att);
@ -2997,7 +2997,7 @@ calDavCalendar.prototype = {
recipients.push(item.organizer);
}
} else {
let atts = item.getAttendees({}).filter(att => {
let atts = item.getAttendees().filter(att => {
return att.getProperty("SCHEDULE-AGENT") == "CLIENT";
});
for (let att of atts) {

Просмотреть файл

@ -1725,7 +1725,7 @@ calStorageCalendar.prototype = {
break;
case "CATEGORIES": {
let cats = cal.category.stringToArray(row.getResultByName("value"));
item.setCategories(cats.length, cats);
item.setCategories(cats);
break;
}
default:
@ -1950,7 +1950,7 @@ calStorageCalendar.prototype = {
break;
case "CATEGORIES": {
let cats = cal.category.stringToArray(row.getResultByName("value"));
item.setCategories(cats.length, cats);
item.setCategories(cats);
break;
}
default:
@ -2282,7 +2282,7 @@ calStorageCalendar.prototype = {
},
prepareAttendees: function(stmts, item, olditem) {
let attendees = item.getAttendees({});
let attendees = item.getAttendees();
if (item.organizer) {
attendees = attendees.concat([]);
attendees.push(item.organizer);
@ -2338,7 +2338,7 @@ calStorageCalendar.prototype = {
this.prepareProperty(stmts, item, name, value);
}
let cats = item.getCategories({});
let cats = item.getCategories();
if (cats.length > 0) {
ret = CAL_ITEM_FLAG.HAS_PROPERTIES;
this.prepareProperty(stmts, item, "CATEGORIES", cal.category.arrayToString(cats));
@ -2385,7 +2385,7 @@ calStorageCalendar.prototype = {
},
prepareAttachments: function(stmts, item, olditem) {
let attachments = item.getAttachments({});
let attachments = item.getAttachments();
if (attachments && attachments.length > 0) {
let array = this.prepareAsyncStatement(stmts, this.mInsertAttachment);
for (let att of attachments) {
@ -2402,7 +2402,7 @@ calStorageCalendar.prototype = {
},
prepareRelations: function(stmts, item, olditem) {
let relations = item.getRelations({});
let relations = item.getRelations();
if (relations && relations.length > 0) {
let array = this.prepareAsyncStatement(stmts, this.mInsertRelation);
for (let rel of relations) {
@ -2419,7 +2419,7 @@ calStorageCalendar.prototype = {
},
prepareAlarms: function(stmts, item, olditem) {
let alarms = item.getAlarms({});
let alarms = item.getAlarms();
if (alarms.length < 1) {
return 0;
}

Просмотреть файл

@ -144,7 +144,7 @@ calWcapCalendar.prototype.encodeRecurrenceParams = function(item, oldItem, exclu
calWcapCalendar.prototype.getAlarmParams = function(item) {
let params = null;
// xxx TODO ALARMSUPPORT check if WCAP supports multiple alarms
let alarms = item.getAlarms({}).filter(x => x.action == "EMAIL");
let alarms = item.getAlarms().filter(x => x.action == "EMAIL");
let alarm = alarms.length > 0 && alarms[0];
if (alarm) {
@ -210,7 +210,7 @@ calWcapCalendar.prototype.isInvitation = function(item) {
};
calWcapCalendar.prototype.getInvitedAttendee = function(item) {
let att = getAttendeeByCalId(item.getAttendees({}), this.calId);
let att = getAttendeeByCalId(item.getAttendees(), this.calId);
if (!att) {
// try to find mail address
let prefMail = this.session.getUserPreferences("X-NSCP-WCAP-PREF-mail");
@ -236,7 +236,7 @@ calWcapCalendar.prototype.canNotify = function(method, item) {
getCalId(item.organizer) == calId
);
case "REPLY": // only if we we're invited from cs, and find matching X-S1CS-CALID:
return getAttendeeByCalId(item.getAttendees({}), calId) != null;
return getAttendeeByCalId(item.getAttendees(), calId) != null;
default:
return false;
}
@ -343,12 +343,12 @@ calWcapCalendar.prototype.storeItem = function(bAddItem, item, oldItem, request)
if (!bAddItem && this.isInvitation(item)) {
// REPLY
method = METHOD_REPLY;
let att = getAttendeeByCalId(item.getAttendees({}), calId);
let att = getAttendeeByCalId(item.getAttendees(), calId);
if (att) {
log("attendee: " + att.icalProperty.icalString, this);
let oldAtt = null;
if (oldItem) {
oldAtt = getAttendeeByCalId(oldItem.getAttendees({}), calId);
oldAtt = getAttendeeByCalId(oldItem.getAttendees(), calId);
}
if (!oldAtt || att.participationStatus != oldAtt.participationStatus) {
// REPLY first for just this calendar:
@ -393,7 +393,7 @@ calWcapCalendar.prototype.storeItem = function(bAddItem, item, oldItem, request)
dtend = item.dueDate;
// cs bug: enforce DUE (set to DTSTART) if alarm is set
if (!dtend && item.getAlarms({}).length) {
if (!dtend && item.getAlarms().length) {
dtend = dtstart;
}
@ -429,11 +429,11 @@ calWcapCalendar.prototype.storeItem = function(bAddItem, item, oldItem, request)
} // else outbound
}
let attendees = item.getAttendees({});
let attendees = item.getAttendees();
if (attendees.length > 0) {
// xxx todo: why ever, X-S1CS-EMAIL is unsupported though documented for calprops... WTF.
let attParam = encodeAttendees(attendees);
if (!oldItem || attParam != encodeAttendees(oldItem.getAttendees({}))) {
if (!oldItem || attParam != encodeAttendees(oldItem.getAttendees())) {
params += "&attendees=" + attParam;
}
@ -443,7 +443,7 @@ calWcapCalendar.prototype.storeItem = function(bAddItem, item, oldItem, request)
method = METHOD_UPDATE;
bNoSmtpNotify = true;
}
} else if (oldItem && oldItem.getAttendees({}).length > 0) {
} else if (oldItem && oldItem.getAttendees().length > 0) {
// else using just PUBLISH
params += "&attendees="; // clear attendees
}
@ -465,9 +465,9 @@ calWcapCalendar.prototype.storeItem = function(bAddItem, item, oldItem, request)
params += "&summary=" + encodeURIComponent(val);
}
let categories = item.getCategories({});
let categories = item.getCategories();
let catParam = encodeCategories(categories);
if (!oldItem || catParam != encodeCategories(oldItem.getCategories({}))) {
if (!oldItem || catParam != encodeCategories(oldItem.getCategories())) {
params += "&categories=" + catParam;
}
@ -647,7 +647,7 @@ calWcapCalendar.prototype.tunnelXProps = function(destItem, srcItem) {
}
// tunnel alarm X-MOZ-SNOOZE only if alarm is still set:
// TODO ALARMSUPPORT still needed when showing alarms as EMAIL for wcap?
let hasAlarms = destItem.getAlarms({}).length;
let hasAlarms = destItem.getAlarms().length;
for (let [name, value] of srcItem.properties) {
try {
if (name.startsWith("X-MOZ-")) {

Просмотреть файл

@ -271,7 +271,7 @@ function getPreviewForEvent(aEvent, aIsTooltip = true) {
boxAppendLabeledText(vbox, "tooltipStatus", statusString);
}
if (event.organizer && event.getAttendees({}).length > 0) {
if (event.organizer && event.getAttendees().length > 0) {
let organizer = event.organizer;
boxAppendLabeledText(vbox, "tooltipOrganizer", organizer);
}

Просмотреть файл

@ -98,13 +98,13 @@ function test_email_alarm() {
let attendee2 = cal.createAttendee();
attendee2.id = "mailto:gustav";
equal(alarm.getAttendees({}).length, 0);
equal(alarm.getAttendees().length, 0);
alarm.addAttendee(attendee1);
equal(alarm.getAttendees({}).length, 1);
equal(alarm.getAttendees().length, 1);
alarm.addAttendee(attendee2);
equal(alarm.getAttendees({}).length, 2);
equal(alarm.getAttendees().length, 2);
alarm.addAttendee(attendee1);
let addedAttendees = alarm.getAttendees({});
let addedAttendees = alarm.getAttendees();
equal(addedAttendees.length, 2);
equal(addedAttendees[0], attendee2);
equal(addedAttendees[1], attendee1);
@ -113,10 +113,10 @@ function test_email_alarm() {
ok(!!alarm.icalComponent.serializeToICS().match(/mailto:gustav/));
alarm.deleteAttendee(attendee1);
equal(alarm.getAttendees({}).length, 1);
equal(alarm.getAttendees().length, 1);
alarm.clearAttendees();
equal(alarm.getAttendees({}).length, 0);
equal(alarm.getAttendees().length, 0);
// Make sure attendees are correctly folded/imported
alarm.icalString = dedent`
@ -171,14 +171,14 @@ function test_audio_alarm() {
// Adding an attachment should work
alarm.addAttachment(sound);
let addedAttachments = alarm.getAttachments({});
let addedAttachments = alarm.getAttachments();
equal(addedAttachments.length, 1);
equal(addedAttachments[0], sound);
ok(alarm.icalString.includes("ATTACH:file:///sound.wav"));
// Adding twice shouldn't change anything
alarm.addAttachment(sound);
addedAttachments = alarm.getAttachments({});
addedAttachments = alarm.getAttachments();
equal(addedAttachments.length, 1);
equal(addedAttachments[0], sound);
@ -191,13 +191,13 @@ function test_audio_alarm() {
// Deleting should work
alarm.deleteAttachment(sound);
addedAttachments = alarm.getAttachments({});
addedAttachments = alarm.getAttachments();
equal(addedAttachments.length, 0);
// As well as clearing
alarm.addAttachment(sound);
alarm.clearAttachments();
addedAttachments = alarm.getAttachments({});
addedAttachments = alarm.getAttachments();
equal(addedAttachments.length, 0);
// AUDIO alarms should only be allowing one attachment, and folding any with the same value
@ -237,19 +237,19 @@ function test_custom_alarm() {
let attendee2 = cal.createAttendee();
attendee2.id = "mailto:gustav";
equal(alarm.getAttendees({}).length, 0);
equal(alarm.getAttendees().length, 0);
alarm.addAttendee(attendee1);
equal(alarm.getAttendees({}).length, 1);
equal(alarm.getAttendees().length, 1);
alarm.addAttendee(attendee2);
equal(alarm.getAttendees({}).length, 2);
equal(alarm.getAttendees().length, 2);
alarm.addAttendee(attendee1);
equal(alarm.getAttendees({}).length, 2);
equal(alarm.getAttendees().length, 2);
alarm.deleteAttendee(attendee1);
equal(alarm.getAttendees({}).length, 1);
equal(alarm.getAttendees().length, 1);
alarm.clearAttendees();
equal(alarm.getAttendees({}).length, 0);
equal(alarm.getAttendees().length, 0);
// Test for attachments
let attach1 = cal.createAttachment();
@ -260,17 +260,17 @@ function test_custom_alarm() {
alarm.addAttachment(attach1);
alarm.addAttachment(attach2);
let addedAttachments = alarm.getAttachments({});
let addedAttachments = alarm.getAttachments();
equal(addedAttachments.length, 2);
equal(addedAttachments[0], attach1);
equal(addedAttachments[1], attach2);
alarm.deleteAttachment(attach1);
addedAttachments = alarm.getAttachments({});
addedAttachments = alarm.getAttachments();
equal(addedAttachments.length, 1);
alarm.clearAttachments();
addedAttachments = alarm.getAttachments({});
addedAttachments = alarm.getAttachments();
equal(addedAttachments.length, 0);
}

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function test_setDefaultValues_events() {
Services.prefs.setIntPref("calendar.alarms.eventalarmlen", 60);
item = cal.createEvent();
cal.alarms.setDefaultValues(item);
alarm = item.getAlarms({})[0];
alarm = item.getAlarms()[0];
ok(alarm);
equal(alarm.related, alarm.ALARM_RELATED_START);
equal(alarm.action, "DISPLAY");
@ -28,7 +28,7 @@ add_task(async function test_setDefaultValues_events() {
Services.prefs.setIntPref("calendar.alarms.eventalarmlen", 20);
item = cal.createEvent();
cal.alarms.setDefaultValues(item);
alarm = item.getAlarms({})[0];
alarm = item.getAlarms()[0];
ok(alarm);
equal(alarm.related, alarm.ALARM_RELATED_START);
equal(alarm.action, "DISPLAY");
@ -37,7 +37,7 @@ add_task(async function test_setDefaultValues_events() {
Services.prefs.setIntPref("calendar.alarms.onforevents", 0);
item = cal.createEvent();
cal.alarms.setDefaultValues(item);
equal(item.getAlarms({}).length, 0);
equal(item.getAlarms().length, 0);
let mockCalendar = {
getProperty: function() {
@ -51,7 +51,7 @@ add_task(async function test_setDefaultValues_events() {
item = cal.createEvent();
item.calendar = mockCalendar;
cal.alarms.setDefaultValues(item);
alarm = item.getAlarms({})[0];
alarm = item.getAlarms()[0];
ok(alarm);
equal(alarm.related, alarm.ALARM_RELATED_START);
equal(alarm.action, "SHOUT");
@ -76,7 +76,7 @@ add_task(async function test_setDefaultValues_tasks() {
item = cal.createTodo();
equal(item.entryDate, null);
cal.alarms.setDefaultValues(item);
alarm = item.getAlarms({})[0];
alarm = item.getAlarms()[0];
ok(alarm);
equal(alarm.related, alarm.ALARM_RELATED_START);
equal(alarm.action, "DISPLAY");
@ -88,7 +88,7 @@ add_task(async function test_setDefaultValues_tasks() {
Services.prefs.setIntPref("calendar.alarms.todoalarmlen", 20);
item = cal.createTodo();
cal.alarms.setDefaultValues(item);
alarm = item.getAlarms({})[0];
alarm = item.getAlarms()[0];
ok(alarm);
equal(alarm.related, alarm.ALARM_RELATED_START);
equal(alarm.action, "DISPLAY");
@ -97,7 +97,7 @@ add_task(async function test_setDefaultValues_tasks() {
Services.prefs.setIntPref("calendar.alarms.onfortodos", 0);
item = cal.createTodo();
cal.alarms.setDefaultValues(item);
equal(item.getAlarms({}).length, 0);
equal(item.getAlarms().length, 0);
let mockCalendar = {
getProperty: function() {
@ -111,7 +111,7 @@ add_task(async function test_setDefaultValues_tasks() {
item = cal.createTodo();
item.calendar = mockCalendar;
cal.alarms.setDefaultValues(item);
alarm = item.getAlarms({})[0];
alarm = item.getAlarms()[0];
ok(alarm);
equal(alarm.related, alarm.ALARM_RELATED_START);
equal(alarm.action, "SHOUT");

Просмотреть файл

@ -11,10 +11,8 @@ function run_test() {
function test_values() {
function findAttendeesInResults(event, expectedAttendees) {
let countObj = {};
// Getting all attendees
let allAttendees = event.getAttendees(countObj);
equal(countObj.value, allAttendees.length);
let allAttendees = event.getAttendees();
equal(allAttendees.length, expectedAttendees.length);
@ -84,8 +82,8 @@ function test_values() {
// Testing cloning
let eventClone = event.clone();
let clonedatts = eventClone.getAttendees({});
let atts = event.getAttendees({});
let clonedatts = eventClone.getAttendees();
let atts = event.getAttendees();
equal(atts.length, clonedatts.length);
for (let i = 0; i < clonedatts.length; i++) {
@ -288,7 +286,7 @@ function test_doubleParameters() {
let event = createEventFromIcalString(ics);
let organizer = [event.organizer];
let attendees = event.getAttendees({});
let attendees = event.getAttendees();
testParameters(organizer, expectedOrganizer);
testParameters(attendees, expectedAttendee);

Просмотреть файл

@ -56,7 +56,7 @@ function serializeEvent_test() {
"urn:uuid:user5",
];
let event = createEventFromIcalString(ics);
let attendees = event.getAttendees({});
let attendees = event.getAttendees();
// check whether all attendees get returned with expected id
for (let attendee of attendees) {

Просмотреть файл

@ -122,7 +122,7 @@ function test_fromICS() {
{ id: "mailto:user7@example.net", partstat: "DECLINED", cname: "PREFIXED" },
];
let event = createEventFromIcalString(ics);
let attendees = event.getAttendees({});
let attendees = event.getAttendees();
// check whether all attendees get returned as expected
equal(attendees.length, expected.length);

Просмотреть файл

@ -103,7 +103,7 @@ function test_fromICS() {
];
let event = createEventFromIcalString(ics);
equal(event.getAttendees({}).length, expected.length, "Check test consistency");
equal(event.getAttendees().length, expected.length, "Check test consistency");
for (let exp of expected) {
let attendee = event.getAttendeeById(exp.id);
equal(attendee.commonName, exp.cname, "Test for commonName matching of " + exp.id);

Просмотреть файл

@ -31,9 +31,9 @@ add_task(async () => {
);
// There should be one alarm, one relation and one attachment
equal(item.getAlarms({}).length, 1);
equal(item.getRelations({}).length, 1);
equal(item.getAttachments({}).length, 1);
equal(item.getAlarms().length, 1);
equal(item.getRelations().length, 1);
equal(item.getAttachments().length, 1);
// Change the occurrence to another day
let occ = item.recurrenceInfo.getOccurrenceFor(cal.createDateTime("20090604T073000Z"));
@ -42,9 +42,9 @@ add_task(async () => {
item.recurrenceInfo.modifyException(occ, true);
// There should still be one alarm, one relation and one attachment
equal(item.getAlarms({}).length, 1);
equal(item.getRelations({}).length, 1);
equal(item.getAttachments({}).length, 1);
equal(item.getAlarms().length, 1);
equal(item.getRelations().length, 1);
equal(item.getAttachments().length, 1);
// Add the item to the storage calendar and retrieve it again
await new Promise(resolve => {
@ -63,7 +63,7 @@ add_task(async () => {
});
// There should still be one alarm, one relation and one attachment
equal(retrievedItem.getAlarms({}).length, 1);
equal(retrievedItem.getRelations({}).length, 1);
equal(retrievedItem.getAttachments({}).length, 1);
equal(retrievedItem.getAlarms().length, 1);
equal(retrievedItem.getRelations().length, 1);
equal(retrievedItem.getAttachments().length, 1);
});

Просмотреть файл

@ -95,22 +95,22 @@ function test_attachment() {
b.rawData = "bruno";
e.addAttachment(a);
equal(e.getAttachments({}).length, 1);
equal(e.getAttachments().length, 1);
e.addAttachment(b);
equal(e.getAttachments({}).length, 2);
equal(e.getAttachments().length, 2);
e.removeAttachment(a);
equal(e.getAttachments({}).length, 1);
equal(e.getAttachments().length, 1);
e.removeAllAttachments();
equal(e.getAttachments({}).length, 0);
equal(e.getAttachments().length, 0);
}
function test_attendee() {
let e = cal.createEvent();
equal(e.getAttendeeById("unknown"), null);
equal(e.getAttendees({}).length, 0);
equal(e.getAttendees().length, 0);
let a = cal.createAttendee();
a.id = "mailto:horst";
@ -119,11 +119,11 @@ function test_attendee() {
b.id = "mailto:bruno";
e.addAttendee(a);
equal(e.getAttendees({}).length, 1);
equal(e.getAttendees().length, 1);
equal(e.getAttendeeById("mailto:horst"), a);
e.addAttendee(b);
equal(e.getAttendees({}).length, 2);
equal(e.getAttendees().length, 2);
let comp = e.icalComponent;
let aprop = comp.getFirstProperty("ATTENDEE");
@ -133,23 +133,23 @@ function test_attendee() {
equal(comp.getNextProperty("ATTENDEE"), null);
e.removeAttendee(a);
equal(e.getAttendees({}).length, 1);
equal(e.getAttendees().length, 1);
equal(e.getAttendeeById("mailto:horst"), null);
e.removeAllAttendees();
equal(e.getAttendees({}).length, 0);
equal(e.getAttendees().length, 0);
}
function test_categories() {
let e = cal.createEvent();
equal(e.getCategories({}).length, 0);
equal(e.getCategories().length, 0);
let cat = ["a", "b", "c"];
e.setCategories(3, cat);
e.setCategories(cat);
cat[0] = "err";
equal(e.getCategories({}).join(","), "a,b,c");
equal(e.getCategories().join(","), "a,b,c");
let comp = e.icalComponent;
let getter = comp.getFirstProperty.bind(comp);
@ -178,13 +178,13 @@ function test_alarm() {
e.addAlarm(alarm2);
equal(e.getAlarms({}).length, 2);
equal(e.getAlarms().length, 2);
e.deleteAlarm(alarm);
equal(e.getAlarms({}).length, 1);
equal(e.getAlarms({})[0], alarm2);
equal(e.getAlarms().length, 1);
equal(e.getAlarms()[0], alarm2);
e.clearAlarms();
equal(e.getAlarms({}).length, 0);
equal(e.getAlarms().length, 0);
}
function test_immutable() {
@ -208,7 +208,7 @@ function test_immutable() {
event.setProperty("X-NAME", "X-VALUE");
event.setPropertyParameter("X-NAME", "X-PARAM", "X-PARAMVAL");
event.setCategories(3, ["a", "b", "c"]);
event.setCategories(["a", "b", "c"]);
equal(event.alarmLastAck.timezone.tzid, cal.dtz.UTC.tzid);
@ -231,7 +231,7 @@ function test_immutable() {
event.parentItem = null;
}, /Can not modify immutable data container/);
throws(() => {
event.setCategories(3, ["d", "e", "f"]);
event.setCategories(["d", "e", "f"]);
}, /Can not modify immutable data container/);
let event2 = event.clone();

Просмотреть файл

@ -43,9 +43,7 @@ function run_test() {
}
function checkRelations(event, expRel) {
let countObj = {};
let allRel = event.getRelations(countObj);
equal(countObj.value, allRel.length);
let allRel = event.getRelations();
equal(allRel.length, expRel.length);
// check if all expacted relations are found
@ -60,7 +58,7 @@ function checkRelations(event, expRel) {
}
function modifyRelations(event, oldRel) {
let allRel = event.getRelations({});
let allRel = event.getRelations();
let rel = allRel[0];
// modify the properties
@ -70,12 +68,12 @@ function modifyRelations(event, oldRel) {
// remove one relation
event.removeRelation(rel);
equal(event.getRelations({}).length, oldRel.length - 1);
equal(event.getRelations().length, oldRel.length - 1);
// add one relation and remove all relations
event.addRelation(oldRel[0]);
event.removeAllRelations();
equal(event.getRelations({}), 0);
equal(event.getRelations(), 0);
}
function test_icalprop() {

Просмотреть файл

@ -45,7 +45,7 @@ add_task(async () => {
equal(item.startDate.compare(cal.createDateTime("20120101T010101Z")), 0);
// Check attachment
let attaches = item.getAttachments({});
let attaches = item.getAttachments();
let attach = attaches[0];
equal(attaches.length, 1);
equal(attach.uri.spec, "http://example.com/test.ics");
@ -54,7 +54,7 @@ add_task(async () => {
equal(attach.getParameter("FILENAME"), "test.ics");
// Check attendee
let attendees = item.getAttendees({});
let attendees = item.getAttendees();
let attendee = attendees[0];
equal(attendees.length, 1);
equal(attendee.id, "mailto:test@example.com");
@ -67,7 +67,7 @@ add_task(async () => {
equal(attendee.getProperty("X-THING"), "BAR");
// Check relation
let relations = item.getRelations({});
let relations = item.getRelations();
let rel = relations[0];
equal(relations.length, 1);
equal(rel.relType, "SIBLING");