mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 712743, if node is black, return early from ::Traverse, r=mccr8,sicking
This commit is contained in:
parent
3851d96683
commit
f16cabefa6
@ -1207,6 +1207,20 @@ nsINode::Trace(nsINode *tmp, TraceCallback cb, void *closure)
|
|||||||
nsContentUtils::TraceWrapper(tmp, cb, 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)
|
||||||
|
{
|
||||||
|
return aNode->IsElement() &&
|
||||||
|
aNode->AsElement()->IsInNamespace(kNameSpaceID_XBL);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
||||||
@ -1217,6 +1231,34 @@ nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nsCCUncollectableMarker::sGeneration) {
|
||||||
|
// If we're black no need to traverse.
|
||||||
|
if (IsBlackNode(tmp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PtrBits problematicFlags =
|
||||||
|
(NODE_IS_ANONYMOUS |
|
||||||
|
NODE_IS_IN_ANONYMOUS_SUBTREE |
|
||||||
|
NODE_IS_NATIVE_ANONYMOUS_ROOT |
|
||||||
|
NODE_MAY_BE_IN_BINDING_MNGR |
|
||||||
|
NODE_IS_INSERTION_PARENT);
|
||||||
|
|
||||||
|
if (!tmp->HasFlag(problematicFlags) && !IsXBL(tmp)) {
|
||||||
|
// If we're in a black document, return early.
|
||||||
|
if ((currentDoc && IsBlackNode(currentDoc))) {
|
||||||
|
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)) {
|
||||||
|
NS_ABORT_IF_FALSE(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNodeInfo)
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user