Bug 1557504 - remove [array] use in xpidl from calIItipItem.idl. r=pmorris
authorKhushil Mistry <khushil324@gmail.com>
Thu, 14 Nov 2019 21:03:07 +0530
changeset 37506 64e5700c2428333fb571e2477b7609badec9d83d
parent 37505 1ce2ab429d0b64c8223ea4f01514c38f16c2b9eb
child 37507 110ee34fe561cae965d3a5aec1d20c4051408c1b
push id396
push userclokep@gmail.com
push dateMon, 06 Jan 2020 23:11:57 +0000
reviewerspmorris
bugs1557504
Bug 1557504 - remove [array] use in xpidl from calIItipItem.idl. r=pmorris
calendar/base/modules/utils/calItipUtils.jsm
calendar/base/public/calIItipItem.idl
calendar/base/src/calItipItem.js
calendar/itip/calItipEmailTransport.js
calendar/lightning/content/imip-bar.js
calendar/lightning/modules/ltnInvitationUtils.jsm
calendar/providers/caldav/calDavCalendar.js
--- a/calendar/base/modules/utils/calItipUtils.jsm
+++ b/calendar/base/modules/utils/calItipUtils.jsm
@@ -321,17 +321,17 @@ var calitip = {
       data.label = cal.l10n.getLtnString("imipBarAlreadyProcessedText");
       if (foundItems && foundItems.length) {
         data.showItems.push("imipDetailsButton");
         if (itipItem.receivedMethod == "COUNTER" && itipItem.sender) {
           if (disallowedCounter) {
             data.label = cal.l10n.getLtnString("imipBarDisallowedCounterText");
           } else {
             let comparison;
-            for (let item of itipItem.getItemList({})) {
+            for (let item of itipItem.getItemList()) {
               let attendees = cal.itip.getAttendeesBySender(item.getAttendees({}), itipItem.sender);
               if (attendees.length == 1) {
                 comparison = calitip.compareSequence(item, foundItems[0]);
                 if (comparison == 1) {
                   data.label = cal.l10n.getLtnString("imipBarCounterErrorText");
                   break;
                 } else if (comparison == -1) {
                   data.label = cal.l10n.getLtnString("imipBarCounterPreviousVersionText");
@@ -342,17 +342,17 @@ var calitip = {
         }
       } else if (itipItem.receivedMethod == "REPLY") {
         // The item has been previously removed from the available calendars or the calendar
         // containing the item is not available
         let delmgr = Cc["@mozilla.org/calendar/deleted-items-manager;1"].getService(
           Ci.calIDeletedItems
         );
         let delTime = null;
-        let items = itipItem.getItemList({});
+        let items = itipItem.getItemList();
         if (items && items.length) {
           delTime = delmgr.getDeletedDate(items[0].id);
         }
         if (delTime) {
           data.label = cal.l10n.getLtnString("imipBarReplyToRecentlyRemovedItem", [
             delTime.toString(),
           ]);
         } else {
@@ -373,41 +373,41 @@ var calitip = {
           break;
         case "PUBLISH":
           data.showItems.push("imipAddButton");
           break;
         case "REQUEST:UPDATE":
         case "REQUEST:NEEDS-ACTION":
         case "REQUEST": {
           let isRecurringMaster = false;
-          for (let item of itipItem.getItemList({})) {
+          for (let item of itipItem.getItemList()) {
             if (item.recurrenceInfo) {
               isRecurringMaster = true;
             }
           }
 
           if (actionFunc.method == "REQUEST:UPDATE") {
             if (isRecurringMaster) {
               data.label = cal.l10n.getLtnString("imipBarUpdateSeriesText");
-            } else if (itipItem.getItemList({}).length > 1) {
+            } else if (itipItem.getItemList().length > 1) {
               data.label = cal.l10n.getLtnString("imipBarUpdateMultipleText");
             } else {
               data.label = cal.l10n.getLtnString("imipBarUpdateText");
             }
           } else if (actionFunc.method == "REQUEST:NEEDS-ACTION") {
             if (isRecurringMaster) {
               data.label = cal.l10n.getLtnString("imipBarProcessedSeriesNeedsAction");
-            } else if (itipItem.getItemList({}).length > 1) {
+            } else if (itipItem.getItemList().length > 1) {
               data.label = cal.l10n.getLtnString("imipBarProcessedMultipleNeedsAction");
             } else {
               data.label = cal.l10n.getLtnString("imipBarProcessedNeedsAction");
             }
           }
 
-          if (itipItem.getItemList({}).length > 1 || isRecurringMaster) {
+          if (itipItem.getItemList().length > 1 || isRecurringMaster) {
             data.showItems.push("imipAcceptRecurrencesButton");
             if (separateButtons) {
               data.showItems.push("imipTentativeRecurrencesButton");
               data.hideItems.push("imipAcceptRecurrencesButton_AcceptLabel");
               data.hideItems.push("imipAcceptRecurrencesButton_TentativeLabel");
               data.hideItems.push("imipAcceptRecurrencesButton_Tentative");
               data.hideItems.push("imipAcceptRecurrencesButton_TentativeDontSend");
             } else {
@@ -600,17 +600,17 @@ var calitip = {
       let calendars = cal
         .getCalendarManager()
         .getCalendars({})
         .filter(calitip.isSchedulingCalendar);
 
       if (aItipItem.receivedMethod == "REQUEST") {
         // try to further limit down the list to those calendars that
         // are configured to a matching attendee;
-        let item = aItipItem.getItemList({})[0];
+        let item = aItipItem.getItemList()[0];
         let matchingCals = calendars.filter(
           calendar => calitip.getInvitedAttendee(item, calendar) != null
         );
         // if there's none, we will show the whole list of calendars:
         if (matchingCals.length > 0) {
           calendars = matchingCals;
         }
       }
@@ -650,17 +650,17 @@ var calitip = {
    * Clean up after the given iTIP item. This needs to be called once for each time
    * processItipItem is called. May be called with a null itipItem in which case it will do
    * nothing.
    *
    * @param {calIItipItem} itipItem      The iTIP item to clean up for.
    */
   cleanupItipItem: function(itipItem) {
     if (itipItem) {
-      let itemList = itipItem.getItemList({});
+      let itemList = itipItem.getItemList();
       if (itemList.length > 0) {
         // Again, we can assume the id is the same over all items per spec
         ItipItemFinderFactory.cleanup(itemList[0].id);
       }
     }
   },
 
   /**
@@ -691,17 +691,17 @@ var calitip = {
       case "PUBLISH":
       case "REQUEST":
       case "CANCEL":
       case "COUNTER":
       case "DECLINECOUNTER":
       case "REPLY": {
         // Per iTIP spec (new Draft 4), multiple items in an iTIP message MUST have
         // same ID, this simplifies our searching, we can just look for Item[0].id
-        let itemList = itipItem.getItemList({});
+        let itemList = itipItem.getItemList();
         if (!itipItem.targetCalendar) {
           optionsFunc(itipItem, Ci.calIErrors.CAL_IS_READONLY);
         } else if (itemList.length > 0) {
           ItipItemFinderFactory.findItem(itemList[0].id, itipItem, optionsFunc);
         } else if (optionsFunc) {
           optionsFunc(itipItem, Cr.NS_OK);
         }
         break;
@@ -1708,17 +1708,17 @@ ItipItemFinder.prototype = {
         //           deletion/modification/addition of occurrences directly on the providers,
         //           which would ease client code a lot.
         case "REFRESH":
         case "PUBLISH":
         case "REQUEST":
         case "REPLY":
         case "COUNTER":
         case "DECLINECOUNTER":
-          for (let itipItemItem of this.mItipItem.getItemList({})) {
+          for (let itipItemItem of this.mItipItem.getItemList()) {
             for (let item of this.mFoundItems) {
               let rid = itipItemItem.recurrenceId; //  XXX todo support multiple
               if (rid) {
                 // actually applies to individual occurrence(s)
                 if (item.recurrenceInfo) {
                   item = item.recurrenceInfo.getOccurrenceFor(rid);
                   if (!item) {
                     continue;
@@ -1904,17 +1904,17 @@ ItipItemFinder.prototype = {
                   break;
                 }
               }
             }
           }
           break;
         case "CANCEL": {
           let modifiedItems = {};
-          for (let itipItemItem of this.mItipItem.getItemList({})) {
+          for (let itipItemItem of this.mItipItem.getItemList()) {
             for (let item of this.mFoundItems) {
               let rid = itipItemItem.recurrenceId; //  XXX todo support multiple
               if (rid) {
                 // actually a CANCEL of occurrence(s)
                 if (item.recurrenceInfo) {
                   // collect all occurrence deletions into a single parent modification:
                   let newItem = modifiedItems[item.id];
                   if (!newItem) {
@@ -1952,17 +1952,17 @@ ItipItemFinder.prototype = {
       // not found:
       cal.LOG("iTIP on " + method + ": no existing items.");
 
       // If the item was not found, observe the target calendar anyway.
       // It will likely be the composite calendar, so we should update
       // if an item was added or removed
       this._observeChanges(this.mItipItem.targetCalendar);
 
-      for (let itipItemItem of this.mItipItem.getItemList({})) {
+      for (let itipItemItem of this.mItipItem.getItemList()) {
         switch (method) {
           case "REQUEST":
           case "PUBLISH": {
             let action = (opListener, partStat, extResponse) => {
               let newItem = itipItemItem.clone();
               setReceivedInfo(newItem, itipItemItem);
               newItem.parentItem.calendar = this.mItipItem.targetCalendar;
               addScheduleAgentClient(newItem, this.mItipItem.targetCalendar);
--- a/calendar/base/public/calIItipItem.idl
+++ b/calendar/base/public/calIItipItem.idl
@@ -97,18 +97,17 @@ interface calIItipItem : nsISupports
      */
     attribute AUTF8String localStatus;
 
     /**
      * Get the list of items that are encapsulated in this calIItipItem
      * @returns An array of calIItemBase items that are inside this
      *          calIItipItem
      */
-    void getItemList(out unsigned long itemCount,
-                     [retval, array, size_is(itemCount)] out calIItemBase items);
+    Array<calIItemBase> getItemList();
 
     /**
      * Modifies the state of the given attendee in the item's ics
      * @param attendeeId - AString containing attendee address
      * @param status - AString containing the new attendee status
      */
     void setAttendeeStatus(in AString attendeeId, in AString status);
 };
--- a/calendar/base/src/calItipItem.js
+++ b/calendar/base/src/calItipItem.js
@@ -174,23 +174,22 @@ calItipItem.prototype = {
     newItem.mSender = this.mSender;
     newItem.mIsSend = this.mIsSend;
     newItem.mIsInitialized = this.mIsInitialized;
     return newItem;
   },
 
   /**
    * This returns both the array and the number of items. An easy way to
-   * call it is: let itemArray = itipItem.getItemList({ });
+   * call it is: let itemArray = itipItem.getItemList();
    */
-  getItemList: function(itemCountRef) {
+  getItemList: function() {
     if (!this.mIsInitialized) {
       throw Cr.NS_ERROR_NOT_INITIALIZED;
     }
-    itemCountRef.value = this.mItemList.length;
     return this.mItemList;
   },
 
   /**
    * Note that this code forces the user to respond to all items in the same
    * way, which is a current limitation of the spec.
    */
   setAttendeeStatus: function(aAttendeeId, aStatus) {
--- a/calendar/itip/calItipEmailTransport.js
+++ b/calendar/itip/calItipEmailTransport.js
@@ -50,17 +50,17 @@ calItipEmailTransport.prototype = {
       return this._sendXpcomMail(aRecipients, items.subject, items.body, aItipItem);
     } else {
       // sending xpcom mail is not available if no identity has been set
       throw Cr.NS_ERROR_NOT_AVAILABLE;
     }
   },
 
   _prepareItems: function(aItipItem) {
-    let item = aItipItem.getItemList({})[0];
+    let item = aItipItem.getItemList()[0];
 
     // Get ourselves some default text - when we handle organizer properly
     // We'll need a way to configure the Common Name attribute and we should
     // use it here rather than the email address
 
     let summary = item.getProperty("SUMMARY") || "";
     let subject = "";
     let body = "";
@@ -317,17 +317,17 @@ calItipEmailTransport.prototype = {
         throw new Error("sendXpcomMail: Unknown autoResponse type: " + aItipItem.autoResponse);
       }
     }
     return false;
   },
 
   _createTempImipFile: function(aToList, aSubject, aBody, aItipItem, aIdentity, aMessageId) {
     try {
-      let itemList = aItipItem.getItemList({});
+      let itemList = aItipItem.getItemList();
       let serializer = Cc["@mozilla.org/calendar/ics-serializer;1"].createInstance(
         Ci.calIIcsSerializer
       );
       serializer.addItems(itemList, itemList.length);
       let methodProp = cal.getIcsService().createIcalProperty("METHOD");
       methodProp.value = aItipItem.responseMethod;
       serializer.addProperty(methodProp);
       let calText = serializer.serializeToString();
--- a/calendar/lightning/content/imip-bar.js
+++ b/calendar/lightning/content/imip-bar.js
@@ -283,17 +283,17 @@ var ltnImipBar = {
       !ltnImipBar.foundItems ||
       !ltnImipBar.foundItems[0] ||
       !ltnImipBar.itipItem
     ) {
       return;
     }
 
     let msgOverlay = ltnImipBar.msgOverlay;
-    let diff = cal.itip.compare(ltnImipBar.itipItem.getItemList({})[0], ltnImipBar.foundItems[0]);
+    let diff = cal.itip.compare(ltnImipBar.itipItem.getItemList()[0], ltnImipBar.foundItems[0]);
     // displaying changes is only needed if that is enabled, an item already exists and there are
     // differences
     if (diff != 0 && Services.prefs.getBoolPref("calendar.itip.displayInvitationChanges", false)) {
       let foundOverlay = ltn.invitation.createInvitationOverlay(
         ltnImipBar.foundItems[0],
         ltnImipBar.itipItem
       );
       let serializedOverlay = cal.xml.serializeDOM(foundOverlay);
@@ -351,17 +351,17 @@ var ltnImipBar = {
           ltnImipBar.resetButtons();
         }
 
         let opListener = {
           QueryInterface: ChromeUtils.generateQI([Ci.calIOperationListener]),
           onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
             if (Components.isSuccessCode(aStatus) && isDeclineCounter) {
               // TODO: move the DECLINECOUNTER stuff to actionFunc
-              aItipItem.getItemList({}).forEach(aItem => {
+              aItipItem.getItemList().forEach(aItem => {
                 // we can rely on the received itipItem to reply at this stage
                 // already, the checks have been done in cal.itip.processFoundItems
                 // when setting up the respective aActionFunc
                 let attendees = cal.itip.getAttendeesBySender(
                   aItem.getAttendees({}),
                   aItipItem.sender
                 );
                 let status = true;
@@ -423,17 +423,17 @@ var ltnImipBar = {
       let counterProposal;
       let items = ltnImipBar.foundItems;
       if (items && items.length) {
         let item = items[0].isMutable ? items[0] : items[0].clone();
 
         if (aParticipantStatus == "X-RESCHEDULE") {
           // TODO most of the following should be moved to the actionFunc defined in
           // calItipUtils
-          let proposedItem = ltnImipBar.itipItem.getItemList({})[0];
+          let proposedItem = ltnImipBar.itipItem.getItemList()[0];
           let proposedRID = proposedItem.getProperty("RECURRENCE-ID");
           if (proposedRID) {
             // if this is a counterproposal for a specific occurrence, we use
             // that to compare with
             item = item.recurrenceInfo.getOccurrenceFor(proposedRID).clone();
           }
           let parsedProposal = ltn.invitation.parseCounter(proposedItem, item);
           let potentialProposers = cal.itip.getAttendeesBySender(
@@ -486,30 +486,30 @@ var ltnImipBar = {
         // Open an extended response dialog to enable the user to add a comment, make a
         // counterproposal, delegate the event or interact in another way.
         // Instead of a dialog, this might be implemented as a separate container inside the
         // imip-overlay as proposed in bug 458578
       }
       let delmgr = Cc["@mozilla.org/calendar/deleted-items-manager;1"].getService(
         Ci.calIDeletedItems
       );
-      let items = ltnImipBar.itipItem.getItemList({});
+      let items = ltnImipBar.itipItem.getItemList();
       if (items && items.length) {
         let delTime = delmgr.getDeletedDate(items[0].id);
         let dialogText = cal.l10n.getLtnString("confirmProcessInvitation");
         let dialogTitle = cal.l10n.getLtnString("confirmProcessInvitationTitle");
         if (delTime && !Services.prompt.confirm(window, dialogTitle, dialogText)) {
           return false;
         }
       }
 
       if (aParticipantStatus == "X-SAVECOPY") {
         // we create and adopt copies of the respective events
         let saveitems = ltnImipBar.itipItem
-          .getItemList({})
+          .getItemList()
           .map(cal.itip.getPublishLikeItemCopy.bind(cal));
         if (saveitems.length > 0) {
           let methods = { receivedMethod: "PUBLISH", responseMethod: "PUBLISH" };
           let newItipItem = cal.itip.getModifiedItipItem(ltnImipBar.itipItem, saveitems, methods);
           // control to avoid processing _execAction on later user changes on the item
           let isFirstProcessing = true;
           // setup callback and trigger re-processing
           let storeCopy = function(aItipItem, aRc, aActionFunc, aFoundItems) {
--- a/calendar/lightning/modules/ltnInvitationUtils.jsm
+++ b/calendar/lightning/modules/ltnInvitationUtils.jsm
@@ -17,17 +17,17 @@ ltn.invitation = {
    * Returns a header title for an ITIP item depending on the response method
    * @param  {calItipItem}     aItipItem  the itip item to check
    * @return {String}          the header title
    */
   getItipHeader: function(aItipItem) {
     let header;
 
     if (aItipItem) {
-      let item = aItipItem.getItemList({})[0];
+      let item = aItipItem.getItemList()[0];
       let summary = item.getProperty("SUMMARY") || "";
       let organizer = item.organizer;
       let organizerString = organizer ? organizer.commonName || organizer.toString() : "";
 
       switch (aItipItem.responseMethod) {
         case "REQUEST":
           header = cal.l10n.getLtnString("itipRequestBody", [organizerString, summary]);
           break;
--- a/calendar/providers/caldav/calDavCalendar.js
+++ b/calendar/providers/caldav/calDavCalendar.js
@@ -2986,17 +2986,17 @@ calDavCalendar.prototype = {
 
     if (this.getProperty("forceEmailScheduling")) {
       return doImipScheduling(this, aRecipients);
     }
 
     if (this.hasAutoScheduling || this.hasScheduling) {
       // let's make sure we notify calendar users marked for client-side scheduling by email
       let recipients = [];
-      for (let item of aItipItem.getItemList({})) {
+      for (let item of aItipItem.getItemList()) {
         if (aItipItem.receivedMethod == "REPLY") {
           if (item.organizer.getProperty("SCHEDULE-AGENT") == "CLIENT") {
             recipients.push(item.organizer);
           }
         } else {
           let atts = item.getAttendees({}).filter(att => {
             return att.getProperty("SCHEDULE-AGENT") == "CLIENT";
           });
@@ -3014,25 +3014,25 @@ calDavCalendar.prototype = {
         return doImipScheduling(this, recipients);
       }
       return true;
     }
 
     // from here on this code for explicit caldav scheduling
     if (aItipItem.responseMethod == "REPLY") {
       // Get my participation status
-      let attendee = aItipItem.getItemList({})[0].getAttendeeById(this.calendarUserAddress);
+      let attendee = aItipItem.getItemList()[0].getAttendeeById(this.calendarUserAddress);
       if (!attendee) {
         return false;
       }
       // work around BUG 351589, the below just removes RSVP:
       aItipItem.setAttendeeStatus(attendee.id, attendee.participationStatus);
     }
 
-    for (let item of aItipItem.getItemList({})) {
+    for (let item of aItipItem.getItemList()) {
       let serializer = Cc["@mozilla.org/calendar/ics-serializer;1"].createInstance(
         Ci.calIIcsSerializer
       );
       serializer.addItems([item], 1);
       let methodProp = cal.getIcsService().createIcalProperty("METHOD");
       methodProp.value = aItipItem.responseMethod;
       serializer.addProperty(methodProp);