Bug 1324904 - remove nsISupportsArray from mozilla/extensions/irc, r=gijs SEA2_48_RELBRANCH SEAMONKEY_2_48_BUILD1 SEAMONKEY_2_48_RELEASE SEAMONKEY_2_48b1_BUILD1 SEAMONKEY_2_48b1_BUILD2 SEAMONKEY_2_48b1_BUILD3 SEAMONKEY_2_48b1_BUILD4 SEAMONKEY_2_48b1_BUILD5 SEAMONKEY_2_48b1_BUILD6 SEAMONKEY_2_48b1_BUILD7 SEAMONKEY_2_48b1_RELEASE SEAMONKEY_2_49_1_BUILD1 SEAMONKEY_2_49_1_BUILD2 SEAMONKEY_2_49_1_BUILD3 SEAMONKEY_2_49_1_BUILD4 SEAMONKEY_2_49_1_RELEASE SEAMONKEY_2_49_2_BUILD1 SEAMONKEY_2_49_2_RELEASE SEAMONKEY_2_49_3_BUILD1 SEAMONKEY_2_49_3_BUILD2 SEAMONKEY_2_49_3_RELEASE SEAMONKEY_2_49_4_BUILD1 SEAMONKEY_2_49_4_RELEASE SEAMONKEY_2_49_5_BUILD1 SEAMONKEY_2_49_5_RELEASE
authoraceman <acelists@atlas.sk>
Tue, 20 Dec 2016 13:46:00 +0000
changeset 2037 b7a99fda77ea3b78708b5bc635a41f6e3ab19b5c
parent 2036 6f73514d10cbf2bdcfac4948a4da4d7f38e9767f
child 2038 c6ddca598a5398ca9a58b14d91bce82b8878bc7b
child 2039 2bdc1355b0ecf3847fe7362febe8ffc683c10b91
child 2058 b514637fbd5404d78ba11db6bb3164fa9895d693
child 2061 cfc7980541c28fe31c59eb8a2a08c943a15cbc60
child 2071 7e87b92a66ec4928c367428d6c816bb6e5ba42e7
child 2103 48b1c12f414fc67216fb6ebb72b5fa66dd00ad6d
child 2109 f5b087da37baebec3254cf81bc90cfef63461e35
child 2117 a0f1cf11a2c7bf7e3fe4f73acc917112df24f4a5
child 2119 0c85b858e65c2e4bc9c7c67a25d412c23bb0ee0a
child 2121 20550eed076c0108262f8ef8b3c5e0b5ba975ef6
child 2129 ad4735b530696798bda3222172fbce51fb47bd14
push id478
push usergijskruitbosch@gmail.com
push dateThu, 22 Dec 2016 12:41:19 +0000
reviewersgijs
bugs1324904
Bug 1324904 - remove nsISupportsArray from mozilla/extensions/irc, r=gijs
xul/content/nsClipboard.js
xul/content/nsDragAndDrop.js
--- a/xul/content/nsClipboard.js
+++ b/xul/content/nsClipboard.js
@@ -36,29 +36,29 @@ var nsClipboard = {
   read: function (aFlavourList, aClipboard, aAnyFlag)
     {
       this.currentClipboard = aClipboard;
       var data = nsTransferable.get(aFlavourList, this.getClipboardTransferable, aAnyFlag);
       return data.first.first;  // only support one item
     },
 
   /**
-   * nsISupportsArray getClipboardTransferable (Object aFlavourList) ;
+   * nsIArray getClipboardTransferable (Object aFlavourList) ;
    *
-   * returns a nsISupportsArray of the item on the clipboard
+   * returns a nsIArray of the item on the clipboard
    *
    * @param Object aFlavourList
    *        formatted list of desired flavours.
    **/
   getClipboardTransferable: function (aFlavourList)
     {
-      const supportsContractID = "@mozilla.org/supports-array;1";
-      const supportsIID = Components.interfaces.nsISupportsArray;
-      var supportsArray = Components.classes[supportsContractID].createInstance(supportsIID);
+      const arrayContractID = "@mozilla.org/array;1";
+      const mutableIID = Components.interfaces.nsIMutableArray;
+      let mutableArray = Components.classes[arrayContractID].createInstance(mutableIID);
       var trans = nsTransferable.createTransferable();
       for (var flavour in aFlavourList)
         trans.addDataFlavor(flavour);
       nsClipboard.mClipboard.getData(trans, nsClipboard.currentClipboard)
-      supportsArray.AppendElement(trans);
-      return supportsArray;
+      mutableArray.appendElement(trans, /* weak */ false);
+      return mutableArray;
     }
 };
 
--- a/xul/content/nsDragAndDrop.js
+++ b/xul/content/nsDragAndDrop.js
@@ -65,40 +65,40 @@ var nsTransferable = {
    *                                   Function aRetrievalFunc, Boolean aAnyFlag) ;
    *
    * Retrieves data from the transferable provided in aRetrievalFunc, formatted
    * for more convenient access.
    *
    * @param FlavourSet aFlavourSet
    *        a FlavourSet object that contains a list of supported flavours.
    * @param Function aRetrievalFunc
-   *        a reference to a function that returns a nsISupportsArray of nsITransferables
+   *        a reference to a function that returns a nsIArray of nsITransferables
    *        for each item from the specified source (clipboard/drag&drop etc)
    * @param Boolean aAnyFlag
    *        a flag specifying whether or not a specific flavour is requested. If false,
    *        data of the type of the first flavour in the flavourlist parameter is returned,
    *        otherwise the best flavour supported will be returned.
    **/
   get: function (aFlavourSet, aRetrievalFunc, aAnyFlag)
     {
       if (!aRetrievalFunc)
         throw "No data retrieval handler provided!";
 
-      var supportsArray = aRetrievalFunc(aFlavourSet);
+      let array = aRetrievalFunc(aFlavourSet);
       var dataArray = [];
-      var count = supportsArray.Count();
+      let count = array.length;
 
       // Iterate over the number of items returned from aRetrievalFunc. For
       // clipboard operations, this is 1, for drag and drop (where multiple
       // items may have been dragged) this could be >1.
       for (var i = 0; i < count; i++)
         {
-          var trans = supportsArray.GetElementAt(i);
-          if (!trans) continue;
-          trans = trans.QueryInterface(Components.interfaces.nsITransferable);
+          let trans = array.queryElementAt(i, Components.interfaces.nsITransferable);
+          if (!trans)
+            continue;
 
           var data = { };
           var length = { };
 
           var currData = null;
           if (aAnyFlag)
             {
               var flavour = { };