nsCOMPtr<nsISupports> isupports( getter_AddRefs(oldAnonymousElements->ElementAt(count)) ); nsCOMPtr<nsIContent> content( do_QueryInterface(isupports) );
nsCOMPtr<nsIContent> content = do_QueryElementAt(oldAnonymousElements, count);
PresShell::SetAnonymousContentFor(nsIContent* aContent, nsISupportsArray* aAnonymousElements){  NS_PRECONDITION(aContent != nsnull, "null ptr");  if (! aContent)    return NS_ERROR_NULL_POINTER;  if (! mAnonymousContentTable) {    mAnonymousContentTable = new nsSupportsHashtable;    if (! mAnonymousContentTable)      return NS_ERROR_OUT_OF_MEMORY;  }  nsISupportsKey key(aContent);  nsCOMPtr<nsISupportsArray> oldAnonymousElements =    getter_AddRefs(NS_STATIC_CAST(nsISupportsArray*, mAnonymousContentTable->Get(&key)));  if (!oldAnonymousElements) {    if (aAnonymousElements) {      mAnonymousContentTable->Put(&key, aAnonymousElements);    }  } else {    if (aAnonymousElements) {      oldAnonymousElements->AppendElements(aAnonymousElements);    } else {      // If we're trying to clear anonymous content for an element that      // already had anonymous content, then we need to be sure to clean      // up after the old content. (This can happen, for example, when a      // reframe occurs.)      PRUint32 count;      oldAnonymousElements->Count(&count);            while (PRInt32(--count) >= 0) {        nsCOMPtr<nsISupports> isupports( getter_AddRefs(oldAnonymousElements->ElementAt(count)) );        nsCOMPtr<nsIContent> content( do_QueryInterface(isupports) );        NS_ASSERTION(content != nsnull, "not an nsIContent");        if (! content)          continue;                content->SetDocument(nsnull, PR_TRUE, PR_TRUE);      }    }  }  return NS_OK;}