mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 713462, don't traverse black content lists, r=mccr8
This commit is contained in:
parent
fb75702799
commit
e29d8131b7
@ -47,9 +47,9 @@
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsGenericElement.h"
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
#include "dombindings.h"
|
||||
@ -80,8 +80,11 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsBaseContentList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsBaseContentList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_OF_NSCOMPTR(mElements)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
if (nsCCUncollectableMarker::sGeneration && tmp->IsBlack()) {
|
||||
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_OF_NSCOMPTR(mElements)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsBaseContentList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
||||
|
@ -1207,13 +1207,6 @@ nsINode::Trace(nsINode *tmp, TraceCallback cb, void *closure)
|
||||
nsContentUtils::TraceWrapper(tmp, cb, closure);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsBlackNode(nsINode* aNode)
|
||||
{
|
||||
JSObject* o = aNode->GetWrapperPreserveColor();
|
||||
return o && !xpc_IsGrayGCThing(o);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsXBL(nsINode* aNode)
|
||||
{
|
||||
@ -1233,7 +1226,7 @@ nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
||||
|
||||
if (nsCCUncollectableMarker::sGeneration) {
|
||||
// If we're black no need to traverse.
|
||||
if (IsBlackNode(tmp)) {
|
||||
if (tmp->IsBlack()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1246,13 +1239,13 @@ nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
||||
|
||||
if (!tmp->HasFlag(problematicFlags) && !IsXBL(tmp)) {
|
||||
// If we're in a black document, return early.
|
||||
if ((currentDoc && IsBlackNode(currentDoc))) {
|
||||
if ((currentDoc && currentDoc->IsBlack())) {
|
||||
return false;
|
||||
}
|
||||
// If we're not in anonymous content and we have a black parent,
|
||||
// return early.
|
||||
nsIContent* parent = tmp->GetParent();
|
||||
if (parent && !IsXBL(parent) && IsBlackNode(parent)) {
|
||||
if (parent && !IsXBL(parent) && parent->IsBlack()) {
|
||||
NS_ABORT_IF_FALSE(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?");
|
||||
return false;
|
||||
}
|
||||
|
@ -190,6 +190,11 @@ public:
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the object has a non-gray wrapper.
|
||||
*/
|
||||
bool IsBlack();
|
||||
|
||||
private:
|
||||
// Only meant to be called by nsContentUtils.
|
||||
void SetPreservingWrapper(bool aPreserve)
|
||||
|
@ -139,4 +139,11 @@ nsWrapperCache::ClearWrapperIfProxy()
|
||||
SetWrapperBits(NULL);
|
||||
}
|
||||
|
||||
inline bool
|
||||
nsWrapperCache::IsBlack()
|
||||
{
|
||||
JSObject* o = GetWrapperPreserveColor();
|
||||
return o && !xpc_IsGrayGCThing(o);
|
||||
}
|
||||
|
||||
#endif /* nsWrapperCache_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user