nsCOMPtr<nsISupportsString> flavorString; nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, nsnull, NS_GET_IID(nsISupportsString), getter_AddRefs(flavorString));
nsCOMPtr<nsISupportsCString> flavorString  = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID);
NS_IMETHODIMP nsHTMLEditor::CanPaste(PRInt32 aSelectionType, PRBool *aCanPaste){  if (!aCanPaste)    return NS_ERROR_NULL_POINTER;  *aCanPaste = PR_FALSE;    // can't paste if readonly  if (!IsModifiable())    return NS_OK;      nsresult rv;  nsCOMPtr<nsIClipboard> clipboard(do_GetService(kCClipboardCID, &rv));  if (NS_FAILED(rv)) return rv;    // the flavors that we can deal with  const char* const textEditorFlavors[] = { kUnicodeMime, nsnull };  const char* const htmlEditorFlavors[] = { kJPEGImageMime, kHTMLMime, nsnull };  nsCOMPtr<nsISupportsArray> flavorsList;  rv = nsComponentManager::CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, nsnull,          NS_GET_IID(nsISupportsArray), getter_AddRefs(flavorsList));  if (NS_FAILED(rv)) return rv;    PRUint32 editorFlags;  GetFlags(&editorFlags);    // add the flavors for all editors  for (const char* const* flavor = textEditorFlavors; *flavor; flavor++)  {    nsCOMPtr<nsISupportsString> flavorString;                nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, nsnull,          NS_GET_IID(nsISupportsString), getter_AddRefs(flavorString));    if (flavorString)    {      flavorString->SetData(*flavor);      flavorsList->AppendElement(flavorString);    }  }    // add the HTML-editor only flavors  if ((editorFlags & eEditorPlaintextMask) == 0)  {    for (const char* const* htmlFlavor = htmlEditorFlavors;         *htmlFlavor;         htmlFlavor++)    {      nsCOMPtr<nsISupportsString> flavorString;                  nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, nsnull,            NS_GET_IID(nsISupportsString), getter_AddRefs(flavorString));      if (flavorString)      {        flavorString->SetData(*htmlFlavor);        flavorsList->AppendElement(flavorString);      }    }  }    PRBool haveFlavors;  rv = clipboard->HasDataMatchingFlavors(flavorsList, aSelectionType, &haveFlavors);  if (NS_FAILED(rv)) return rv;    *aCanPaste = haveFlavors;  return NS_OK;}