nsCOMPtr<nsIXBLBinding> binding(do_QueryInterface(supp)); if (binding) binding->ExecuteAttachedHandler(); else { nsCOMPtr<nsIXBLBindingAttachedHandler> handler(do_QueryInterface(supp)); if (handler) handler->OnBindingAttached(); }
PRInt32 lastItem; while ((lastItem = mAttachedStack.Count() - 1) >= 0) { nsXBLBinding *binding = NS_STATIC_CAST(nsXBLBinding*, mAttachedStack.FastElementAt(lastItem)); mAttachedStack.RemoveElementAt(lastItem);  NS_ASSERTION(binding, "null item in attached stack?"); binding->ExecuteAttachedHandler(); NS_RELEASE(binding);
nsBindingManager::ProcessAttachedQueue(){  if (!mAttachedQueue)    return NS_OK;  PRUint32 count;  mAttachedQueue->Count(&count);  for (PRUint32 i = 0; i < count; i++) {    nsCOMPtr<nsISupports> supp;    mAttachedQueue->GetElementAt(0, getter_AddRefs(supp));    mAttachedQueue->RemoveElementAt(0);    nsCOMPtr<nsIXBLBinding> binding(do_QueryInterface(supp));    if (binding)      binding->ExecuteAttachedHandler();    else {      nsCOMPtr<nsIXBLBindingAttachedHandler> handler(do_QueryInterface(supp));      if (handler)        handler->OnBindingAttached();    }  }  ClearAttachedQueue();  return NS_OK;}