Make wrapper preservation (the mechanism that makes the GC use reachability information between certain C++ objects rather than rooting at language boundaries) use an interface (nsIDOMGCParticipant) to get reachability information. Preserve the wrappers for event handlers as long as what they are attached to is reachable (from C++ or JS) to avoid entraining event handler closures in cycles. b=241518 r=mrbkap sr=jst

git-svn-id: svn://10.0.0.236/trunk@185636 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org
2005-12-03 07:42:40 +00:00
parent 1bafd7404b
commit 6efef3c0ad
34 changed files with 683 additions and 250 deletions

View File

@@ -94,6 +94,7 @@ NS_IMPL_RELEASE(nsGenericDOMDataNode)
NS_INTERFACE_MAP_BEGIN(nsGenericDOMDataNode)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
NS_INTERFACE_MAP_ENTRY(nsIDOMGCParticipant)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventReceiver,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventTarget,
@@ -632,6 +633,30 @@ nsGenericDOMDataNode::ToCString(nsAString& aBuf, PRInt32 aOffset,
}
#endif
/**
* See comment for nsGenericElement::GetSCCIndex
*/
nsIDOMGCParticipant*
nsGenericDOMDataNode::GetSCCIndex()
{
// This is an optimized way of walking nsIDOMNode::GetParentNode to
// the top of the tree.
nsIDOMGCParticipant *result = GetCurrentDoc();
if (!result) {
nsIContent *top = this;
while (top->GetParent())
top = top->GetParent();
result = top;
}
return result;
}
void
nsGenericDOMDataNode::AppendReachableList(nsCOMArray<nsIDOMGCParticipant>& aArray)
{
}
nsresult
nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,