context:   copyBookmark: function (aSelection)  {    const kSuppArrayContractID = "@mozilla.org/supports-array;1";    const kSuppArrayIID = Components.interfaces.nsISupportsArray;    var itemArray = Components.classes[kSuppArrayContractID].createInstance(kSuppArrayIID);    const kSuppWStringContractID = "@mozilla.org/supports-string;1";    const kSuppWStringIID = Components.interfaces.nsISupportsString;    var bmstring = Components.classes[kSuppWStringContractID].createInstance(kSuppWStringIID);    var unicodestring = Components.classes[kSuppWStringContractID].createInstance(kSuppWStringIID);    var htmlstring = Components.classes[kSuppWStringContractID].createInstance(kSuppWStringIID);      var sBookmarkItem = ""; var sTextUnicode = ""; var sTextHTML = ""; var tmpBmItem = [];    for (var i = 0; i < aSelection.length; ++i) {      sBookmarkItem += aSelection.item[i].Value + "\n";      // save the selection property into text string that we will use later in paste function      // and in BookmarkInsertTransaction      // (if the selection is folder or livemark save all childs property)      var aType = BookmarksUtils.resolveType(aSelection.item[i]);      if (aType == "Livemark") {        sBookmarkItem += "\n\n\n\n\n\n"; // don't change livemark properties      } else {         for (var j = 0; j < gBmProperties.length; ++j) {            var itemValue = BMDS.GetTarget(aSelection.item[i], gBmProperties[j], true);            if (itemValue)                sBookmarkItem += itemValue.QueryInterface(kRDFLITIID).Value + "\n";            else                sBookmarkItem += "\n";         }      }      var childCount = 1;      if (aType == "Folder" || aType == "Livemark") {         var propArray = [];         BookmarksUtils.getAllChildren(aSelection.item[i], propArray);         for (var k = 0; k < propArray.length; ++k) {            for (var j = 0; j < gBmProperties.length + 1; ++j) {               if (propArray[k][j])                   sBookmarkItem += propArray[k][j].Value + "\n";               else                   sBookmarkItem += "\n";            }         }         childCount += propArray.length;      }      tmpBmItem.push(childCount +  "\n" + sBookmarkItem);      sBookmarkItem = "";      var url  = BookmarksUtils.getProperty(aSelection.item[i], gNC_NS+"URL" );      var name = BookmarksUtils.getProperty(aSelection.item[i], gNC_NS+"Name");      sTextUnicode += url + "\n";      sTextHTML += "<A HREF=\"" + url + "\">" + name + "</A>";    }    sTextUnicode = sTextUnicode.replace(/\n$/,"");        // generate unique separator and combine the array to one string     var bmSeparator = "]-[", extrarSeparator = "@";    for (var i = 0; i < tmpBmItem.length; ++i) {        while (tmpBmItem[i].indexOf(bmSeparator)>-1)           bmSeparator += extrarSeparator;    }    for (var i = 0; i < tmpBmItem.length; ++i) {      sBookmarkItem += tmpBmItem[i] + bmSeparator;    }    // insert the separator to sBookmarkItem so we can extract it in pasteBookmark    sBookmarkItem = bmSeparator + "\n" + sBookmarkItem;        const kXferableContractID = "@mozilla.org/widget/transferable;1";    const kXferableIID = Components.interfaces.nsITransferable;    var xferable = Components.classes[kXferableContractID].createInstance(kXferableIID);    xferable.addDataFlavor("moz/bookmarkclipboarditem");    bmstring.data = sBookmarkItem;    xferable.setTransferData("moz/bookmarkclipboarditem", bmstring, sBookmarkItem.length*2);        xferable.addDataFlavor("text/html");    htmlstring.data = sTextHTML;    xferable.setTransferData("text/html", htmlstring, sTextHTML.length*2);        xferable.addDataFlavor("text/unicode");    unicodestring.data = sTextUnicode;    xferable.setTransferData("text/unicode", unicodestring, sTextUnicode.length*2);        const kClipboardContractID = "@mozilla.org/widget/clipboard;1";    const kClipboardIID = Components.interfaces.nsIClipboard;    var clipboard = Components.classes[kClipboardContractID].getService(kClipboardIID);    clipboard.setData(xferable, null, kClipboardIID.kGlobalClipboard);  },
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/b63d39c4e1a2a46f8806477e84548ce028e9554a/bookmarks.js/clean/browser/components/bookmarks/content/bookmarks.js