Bug 1562152 - remove [array] use in xpidl from mail/. r=khushil
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 28 Jun 2019 11:33:48 +0300
changeset 36013 18730409abca6aef027355fdceb339c6feb35920
parent 36012 d530d815c2968fdd3003569226a3aaae5916e9c0
child 36014 81b346228baa3efef3636b21ba3f332c3f49e035
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewerskhushil
bugs1562152
Bug 1562152 - remove [array] use in xpidl from mail/. r=khushil
mail/components/activity/content/activity-widgets.js
mail/components/activity/content/activity.js
mail/components/activity/modules/moveCopy.jsm
mail/components/activity/nsActivityManager.js
mail/components/activity/nsIActivityManager.idl
--- a/mail/components/activity/content/activity-widgets.js
+++ b/mail/components/activity/content/activity-widgets.js
@@ -239,17 +239,17 @@
     }
 
     get processes() {
       return this.querySelector(".activitygroupbox");
     }
 
     retry() {
       let processes = activityManager.getProcessesByContext(this.contextType,
-        this.contextObj, {});
+        this.contextObj);
       for (let process of processes) {
         if (process.retryHandler) {
           process.retryHandler.retry(process);
         }
       }
     }
   }
 
--- a/mail/components/activity/content/activity.js
+++ b/mail/components/activity/content/activity.js
@@ -169,34 +169,34 @@ var activityObject = {
 
   // -----------------
   // Startup, Shutdown
 
   startup() {
     try {
       this._activitiesView = document.getElementById("activityView");
 
-      let activities = activityManager.getActivities({});
+      let activities = activityManager.getActivities();
       for (let iActivity = Math.max(0, activities.length - ACTIVITY_LIMIT);
            iActivity < activities.length; iActivity++) {
         let activity = activities[iActivity];
         this.addActivityElement(activity.id, activity);
       }
 
       // start listening changes in the activity manager's
       // internal list
       this._activityMgrListener = new this.ActivityMgrListener();
       activityManager.addListener(this._activityMgrListener);
     } catch (e) {
       this._activityLogger.error("Exception: " + e);
     }
   },
 
   rebuild() {
-    let activities = activityManager.getActivities({});
+    let activities = activityManager.getActivities();
     for (let activity of activities) {
       this.addActivityElement(activity.id, activity);
     }
   },
 
   shutdown() {
     activityManager.removeListener(this._activityMgrListener);
   },
--- a/mail/components/activity/modules/moveCopy.jsm
+++ b/mail/components/activity/modules/moveCopy.jsm
@@ -54,17 +54,17 @@ var moveCopyModule = {
     let count = aMsgList.length;
     if (count <= 0)
       return;
 
     let displayCount = count;
     // get the folder of the deleted messages
     let folder = aMsgList.queryElementAt(0, Ci.nsIMsgDBHdr).folder;
 
-    let activities = this.activityMgr.getActivities({});
+    let activities = this.activityMgr.getActivities();
     if (activities.length > 0 &&
         activities[activities.length - 1].id == this.lastMessage.id &&
         this.lastMessage.type == "deleteMail" &&
         this.lastMessage.folder == folder.prettyName) {
       displayCount += this.lastMessage.count;
       this.activityMgr.removeActivity(this.lastMessage.id);
     }
 
@@ -104,17 +104,17 @@ var moveCopyModule = {
         return;
 
       // get the folder of the moved/copied messages
       let folder = aSrcMsgList.queryElementAt(0, Ci.nsIMsgDBHdr).folder;
       this.log.info("got folder");
 
       let displayCount = count;
 
-      let activities = this.activityMgr.getActivities({});
+      let activities = this.activityMgr.getActivities();
       if (activities.length > 0 &&
           activities[activities.length - 1].id == this.lastMessage.id &&
           this.lastMessage.type == (aMove ? "moveMail" : "copyMail") &&
           this.lastMessage.sourceFolder == folder.prettyName &&
           this.lastMessage.destFolder == aDestFolder.prettyName) {
         displayCount += this.lastMessage.count;
         this.activityMgr.removeActivity(this.lastMessage.id);
       }
@@ -282,17 +282,17 @@ var moveCopyModule = {
         this.log.info("in UnincorporatedMessageMoved");
 
         // get the folder of the moved/copied messages
         let destFolder = msgHdr.folder;
         this.log.info("got folder");
 
         let displayCount = 1;
 
-        let activities = this.activityMgr.getActivities({});
+        let activities = this.activityMgr.getActivities();
         if (activities.length > 0 &&
             activities[activities.length - 1].id == this.lastMessage.id &&
             this.lastMessage.type == "moveMail" &&
             this.lastMessage.sourceFolder == srcFolder.prettyName &&
             this.lastMessage.destFolder == destFolder.prettyName) {
           displayCount += this.lastMessage.count;
           this.activityMgr.removeActivity(this.lastMessage.id);
         }
--- a/mail/components/activity/nsActivityManager.js
+++ b/mail/components/activity/nsActivityManager.js
@@ -23,27 +23,25 @@ nsActivityManager.prototype = {
     for (let value of this._activities.values()) {
       if (value instanceof Ci.nsIActivityProcess)
         count++;
     }
 
     return count;
   },
 
-  getProcessesByContext(aContextType, aContextObj, aCount) {
+  getProcessesByContext(aContextType, aContextObj) {
     let list = [];
     for (let activity of this._activities.values()) {
       if (activity instanceof Ci.nsIActivityProcess &&
           activity.contextType == aContextType &&
           activity.contextObj == aContextObj) {
         list.push(activity);
       }
     }
-
-    aCount.value = list.length;
     return list;
   },
 
   get db() {
     return null;
   },
 
   get nextId() {
@@ -121,21 +119,18 @@ nsActivityManager.prototype = {
       throw Cr.NS_ERROR_NOT_AVAILABLE;
     return this._activities.get(aID);
   },
 
   containsActivity(aID) {
     return this._activities.has(aID);
   },
 
-  getActivities(aCount) {
-    let list = [...this._activities.values()];
-
-    aCount.value = list.length;
-    return list;
+  getActivities() {
+    return [...this._activities.values()];
   },
 
   addListener(aListener) {
     this.log.info("addListener\n");
     this._listeners.push(aListener);
   },
 
   removeListener(aListener) {
--- a/mail/components/activity/nsIActivityManager.idl
+++ b/mail/components/activity/nsIActivityManager.idl
@@ -100,28 +100,25 @@ interface nsIActivityManager : nsISuppor
   /**
    * Retrieves all activities managed by the activity manager. This can be one
    * that is in progress (process), one that is represented as a warning, or one
    * that has completed (event) in the past and is stored in the persistent
    * store.
    *
    * @return A read-only list of activities managed by the activity manager.
    */
-  void getActivities(out unsigned long length,
-                  [retval, array, size_is(length)] out nsIActivity aActivities);
+  Array<nsIActivity> getActivities();
   
   /**
    * Retrieves processes with given context type and object.
    *
    * @return A read-only list of processes matching to given criteria.
    */
-  void getProcessesByContext(in AString aContextType,
-                             in nsIVariant aContextObject,
-                             out unsigned long length,
-                             [retval, array, size_is(length)] out nsIActivityProcess aProcesses);
+  Array<nsIActivityProcess> getProcessesByContext(in AString aContextType,
+                                                  in nsIVariant aContextObject);
 
   /**
    *  Call to remove all activities apart from those that are in progress.
    */
   void cleanUp();
 
   /**
    * The number of processes in the activity list.