Bug 1324904 - remove nsISupportsArray from mozilla/extensions/irc, r=gijs
--- 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 = { };