nsCOMPtr<nsIDocumentObserver> obs(do_QueryInterface(shell)); if (!childFrame) obs->ContentInserted(doc, parent, mBoundElement, index);
if (!childFrame) {  nsCOMPtr<nsIFrameManager> frameManager; shell->GetFrameManager(getter_AddRefs(frameManager)); nsCOMPtr<nsIStyleContext> sc; frameManager->GetUndisplayedContent(mBoundElement, getter_AddRefs(sc)); if (!sc) { nsCOMPtr<nsIDocumentObserver> obs(do_QueryInterface(shell)); obs->ContentInserted(doc, parent, mBoundElement, index); } }
  void DocumentLoaded(nsIDocument* aBindingDoc)  {    nsCOMPtr<nsIDocument> doc;    mBoundElement->GetDocument(*getter_AddRefs(doc));    if (!doc)      return;    // Get the binding.    PRBool ready = PR_FALSE;    gXBLService->BindingReady(mBoundElement, mBindingURL, &ready);    if (!ready)      return;    // XXX Deal with layered bindings.    // Now do a ContentInserted notification to cause the frames to get installed finally,    nsCOMPtr<nsIContent> parent;    mBoundElement->GetParent(*getter_AddRefs(parent));    PRInt32 index = 0;    if (parent)      parent->IndexOf(mBoundElement, index);            nsCOMPtr<nsIPresShell> shell;    doc->GetShellAt(0, getter_AddRefs(shell));    if (shell) {      nsIFrame* childFrame;      shell->GetPrimaryFrameFor(mBoundElement, &childFrame);      nsCOMPtr<nsIDocumentObserver> obs(do_QueryInterface(shell));      if (!childFrame)        obs->ContentInserted(doc, parent, mBoundElement, index);    }  }