NS_NewXBLInsertionPoint(parent, -1, nsnull, getter_AddRefs(pseudoPoint));
NS_NewXBLInsertionPoint(parent.get(), -1, nsnull, getter_AddRefs(pseudoPoint));
PRBool PR_CALLBACK BuildContentLists(nsHashKey* aKey, void* aData, void* aClosure){  ContentListData* data = (ContentListData*)aClosure;  nsIBindingManager* bm = data->mBindingManager;  nsXBLBinding* binding = data->mBinding;  nsCOMPtr<nsIContent> boundElement;  binding->GetBoundElement(getter_AddRefs(boundElement));  nsISupportsArray* arr = (nsISupportsArray*)aData;  PRUint32 count;  arr->Count(&count);    if (count == 0)    return NS_OK;  // XXX Could this array just be altered in place and passed directly to  // SetContentListFor?  We'd save space if we could pull this off.  nsCOMPtr<nsISupportsArray> contentList;  NS_NewISupportsArray(getter_AddRefs(contentList));  // Figure out the relevant content node.  PRUint32 j = 0;  nsCOMPtr<nsIXBLInsertionPoint> currPoint = getter_AddRefs((nsIXBLInsertionPoint*)arr->ElementAt(j));  nsCOMPtr<nsIContent> parent;  PRInt32 currIndex;  currPoint->GetInsertionParent(getter_AddRefs(parent));  currPoint->GetInsertionIndex(&currIndex);  nsCOMPtr<nsIDOMNodeList> nodeList;  if (parent == boundElement) {    // We are altering anonymous nodes to accommodate insertion points.    binding->GetAnonymousNodes(getter_AddRefs(nodeList));  }  else {    // We are altering the explicit content list of a node to accommodate insertion points.    nsCOMPtr<nsIDOMNode> node(do_QueryInterface(parent));    node->GetChildNodes(getter_AddRefs(nodeList));  }  nsCOMPtr<nsIXBLInsertionPoint> pseudoPoint;  PRUint32 childCount;  nodeList->GetLength(&childCount);  for (PRUint32 i = 0; i < childCount; i++) {    nsCOMPtr<nsIDOMNode> node;    nodeList->Item(i, getter_AddRefs(node));    nsCOMPtr<nsIContent> child(do_QueryInterface(node));    if (((PRInt32)i) == currIndex) {      // Add the currPoint to the supports array.      contentList->AppendElement(currPoint);      // Get the next real insertion point and update our currIndex.      j++;      if (j < count) {        currPoint = getter_AddRefs((nsIXBLInsertionPoint*)arr->ElementAt(j));        currPoint->GetInsertionIndex(&currIndex);      }      // Null out our current pseudo-point.      pseudoPoint = nsnull;    }        if (!pseudoPoint) {      NS_NewXBLInsertionPoint(parent, -1, nsnull, getter_AddRefs(pseudoPoint));      contentList->AppendElement(pseudoPoint);    }    pseudoPoint->AddChild(child);  }  // Add in all the remaining insertion points.  for ( ; j < count; j++) {      currPoint = getter_AddRefs((nsIXBLInsertionPoint*)arr->ElementAt(j));      contentList->AppendElement(currPoint);  }    // Now set the content list using the binding manager,  // If the bound element is the parent, then we alter the anonymous node list  // instead.  This allows us to always maintain two distinct lists should  // insertion points be nested into an inner binding.  if (parent == boundElement)    bm->SetAnonymousNodesFor(parent, contentList);  else     bm->SetContentListFor(parent, contentList);  return PR_TRUE;}