Followup to bug 368774, fix bustage the right way.
authorpeterv@propagandism.org
Thu, 24 May 2007 11:39:49 -0700
changeset 1833 6aa0d1c707e2cb1efaf319ebe3d4918235178697
parent 1832 9a95470be5a3f841f2ed153050645ef42f0406c6
child 1834 2870001c2e0389a345f314beda8808432a02e210
push idunknown
push userunknown
push dateunknown
bugs368774
milestone1.9a5pre
Followup to bug 368774, fix bustage the right way.
content/xbl/src/nsXBLProtoImpl.cpp
content/xbl/src/nsXBLProtoImplMethod.cpp
content/xbl/src/nsXBLProtoImplProperty.cpp
--- a/content/xbl/src/nsXBLProtoImpl.cpp
+++ b/content/xbl/src/nsXBLProtoImpl.cpp
@@ -196,16 +196,23 @@ nsXBLProtoImpl::CompilePrototypeMembers(
     }
   }
   return NS_OK;
 }
 
 void
 nsXBLProtoImpl::Traverse(nsCycleCollectionTraversalCallback &cb) const
 {
+  // If we don't have a class object then we either didn't compile members
+  // or we only have fields, in both cases there are no cycles through our
+  // members.
+  if (!mClassObject) {
+    return;
+  }
+
   nsXBLProtoImplMember *member;
   for (member = mMembers; member; member = member->GetNext()) {
     member->Traverse(cb);
   }
 }
 
 void
 nsXBLProtoImpl::DestroyMembers(nsXBLProtoImplMember* aBrokenMember)
--- a/content/xbl/src/nsXBLProtoImplMethod.cpp
+++ b/content/xbl/src/nsXBLProtoImplMethod.cpp
@@ -274,21 +274,19 @@ nsXBLProtoImplMethod::CompileMember(nsIS
   mIsCompiled = NS_SUCCEEDED(rv);
 #endif
   return rv;
 }
 
 void
 nsXBLProtoImplMethod::Traverse(nsCycleCollectionTraversalCallback &cb) const
 {
-/*
-  if (mIsCompiled) {
-    cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, mJSMethodObject);
-  }
-*/
+  NS_ASSERTION(mIsCompiled, "Shouldn't traverse uncompiled method");
+
+  cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, mJSMethodObject);
 }
 
 nsresult
 nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
 {
   NS_PRECONDITION(mIsCompiled, "Can't execute uncompiled method");
   
   if (!mJSMethodObject) {
--- a/content/xbl/src/nsXBLProtoImplProperty.cpp
+++ b/content/xbl/src/nsXBLProtoImplProperty.cpp
@@ -342,16 +342,18 @@ nsXBLProtoImplProperty::CompileMember(ns
 #endif
   
   return rv;
 }
 
 void
 nsXBLProtoImplProperty::Traverse(nsCycleCollectionTraversalCallback &cb) const
 {
+  NS_ASSERTION(mIsCompiled, "Shouldn't traverse uncompiled method");
+
   if (mJSAttributes & JSPROP_GETTER) {
     cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, mJSGetterObject);
   }
 
   if (mJSAttributes & JSPROP_SETTER) {
     cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, mJSSetterObject);
   }
 }