Bug 727625 - remove childless nsDOMCSSAttributeDeclaration from the purple buffer. r=smaug

This commit is contained in:
Andrew McCreight 2012-02-16 08:45:19 -08:00
parent 2f190b75f4
commit dcb1ed46ad
2 changed files with 21 additions and 2 deletions

View File

@ -49,6 +49,7 @@
#include "nsIPrincipal.h" #include "nsIPrincipal.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "nsNodeUtils.h" #include "nsNodeUtils.h"
#include "nsGenericElement.h"
namespace css = mozilla::css; namespace css = mozilla::css;
namespace dom = mozilla::dom; namespace dom = mozilla::dom;
@ -68,8 +69,26 @@ nsDOMCSSAttributeDeclaration::~nsDOMCSSAttributeDeclaration()
MOZ_COUNT_DTOR(nsDOMCSSAttributeDeclaration); MOZ_COUNT_DTOR(nsDOMCSSAttributeDeclaration);
} }
// If nsDOMCSSAttributeDeclaration is changed so that any additional
// fields are traversed by the cycle collector (for instance, if
// wrapper cache handling is changed) then CAN_SKIP must be updated.
NS_IMPL_CYCLE_COLLECTION_1(nsDOMCSSAttributeDeclaration, mElement) NS_IMPL_CYCLE_COLLECTION_1(nsDOMCSSAttributeDeclaration, mElement)
// nsDOMCSSAttributeDeclaration has only one cycle collected field, so
// if mElement is going to be skipped, the attribute declaration can't
// be part of a garbage cycle.
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDOMCSSAttributeDeclaration)
return !tmp->mElement || nsGenericElement::CanSkip(tmp->mElement, true);
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsDOMCSSAttributeDeclaration)
return !tmp->mElement || nsGenericElement::CanSkipInCC(tmp->mElement);
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
// CanSkipThis returns false to avoid problems with incomplete unlinking.
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsDOMCSSAttributeDeclaration)
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
NS_INTERFACE_MAP_BEGIN(nsDOMCSSAttributeDeclaration) NS_INTERFACE_MAP_BEGIN(nsDOMCSSAttributeDeclaration)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMCSSAttributeDeclaration) NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDOMCSSAttributeDeclaration)

View File

@ -66,8 +66,8 @@ public:
~nsDOMCSSAttributeDeclaration(); ~nsDOMCSSAttributeDeclaration();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMCSSAttributeDeclaration, NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS_AMBIGUOUS(nsDOMCSSAttributeDeclaration,
nsICSSDeclaration) nsICSSDeclaration)
// If GetCSSDeclaration returns non-null, then the decl it returns // If GetCSSDeclaration returns non-null, then the decl it returns
// is owned by our current style rule. // is owned by our current style rule.