Fix for bug 474456. r/sr=bz.
authorPeter Van der Beken <peterv@propagandism.org>
Thu, 05 Feb 2009 10:42:55 +0100
changeset 24671 5de9f1e51c68b15bcec8c936a065334f6a3ec50b
parent 24670 8f00a474299142afc977c5a80229c78df0c0cae6
child 24673 90e5130c458e70ed57a25326f8c06f4d1e0a3136
push id5154
push userpvanderbeken@mozilla.com
push dateThu, 05 Feb 2009 09:43:07 +0000
treeherdermozilla-central@5de9f1e51c68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs474456
milestone1.9.2a1pre
Fix for bug 474456. r/sr=bz.
content/base/src/nsGenericElement.cpp
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -2653,31 +2653,31 @@ void
 nsGenericElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
 {
   NS_PRECONDITION(aDeep || (!GetCurrentDoc() && !GetBindingParent()),
                   "Shallow unbind won't clear document and binding parent on "
                   "kids!");
   // Make sure to unbind this node before doing the kids
   nsIDocument *document =
     HasFlag(NODE_FORCE_XBL_BINDINGS) ? GetOwnerDoc() : GetCurrentDoc();
+
+  mParentPtrBits = aNullParent ? 0 : mParentPtrBits & ~PARENT_BIT_INDOCUMENT;
+
   if (document) {
     // Notify XBL- & nsIAnonymousContentCreator-generated
     // anonymous content that the document is changing.
     document->BindingManager()->ChangeDocumentFor(this, document, nsnull);
 
     if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {
       document->ForgetLink(this);
     }
 
     document->ClearBoxObjectFor(this);
   }
 
-  // Unset things in the reverse order from how we set them in BindToTree
-  mParentPtrBits = aNullParent ? 0 : mParentPtrBits & ~PARENT_BIT_INDOCUMENT;
-
   // Unset this since that's what the old code effectively did.
   UnsetFlags(NODE_FORCE_XBL_BINDINGS);
   
 #ifdef MOZ_XUL
   nsXULElement* xulElem = nsXULElement::FromContent(this);
   if (xulElem) {
     xulElem->SetXULBindingParent(nsnull);
   }