Break cycle-through-XPCOM by adding an assignment to null when done with |iterator|. b=285065 r+sr=bryner

This commit is contained in:
dbaron%dbaron.org 2005-03-07 04:36:44 +00:00
parent fdf2a0d680
commit aa62d91bc1
2 changed files with 11 additions and 0 deletions

View File

@ -221,6 +221,11 @@
while (iterator.nextNode())
radioChildren.push(iterator.currentNode);
// assign null to break circular reference between _filterRadioGroup
// and iterator (via this scope)
// XXX The function really should be global instead of local.
iterator = null;
return this.mRadioChildren = radioChildren;
]]>
</body>

View File

@ -220,6 +220,12 @@
var iterator = this.ownerDocument.createTreeWalker(this, NodeFilter.SHOW_ELEMENT, _filterRadioGroup, true);
while (iterator.nextNode())
radioChildren.push(iterator.currentNode);
// assign null to break circular reference between _filterRadioGroup
// and iterator (via this scope)
// XXX The function really should be global instead of local.
iterator = null;
return this.mRadioChildren = radioChildren;
]]>
</body>