Null out browser's focusedWindow field as well (to prevent leaks). b=283063 r=mconnor

This commit is contained in:
dbaron@dbaron.org 2007-08-21 21:59:56 -07:00
parent aac621dcf4
commit 48836e0727

View File

@ -1139,7 +1139,16 @@
// clean up the before/afterselected attributes before removing the tab
oldTab.selected = false;
// XXX browser's destructor isn't always called, so we force a cleanup ourselves
// Because of the way XBL works (fields just set JS
// properties on the element) and the code we have in place
// to preserve the JS objects for any elements that have
// JS properties set on them, the browser element won't be
// destroyed until the document goes away. So we force a
// cleanup ourselves.
// This has to hapen before we remove the child so that the
// XBL implementation of nsIObserver still works. But
// clearing focusedWindow happens below because it gets
// reset by updateCurrentBrowser.
oldBrowser.destroy();
this.mTabContainer.removeChild(oldTab);
@ -1149,6 +1158,9 @@
this.mPanelContainer.selectedIndex = newIndex;
this.updateCurrentBrowser();
// see comment above destroy above
oldBrowser.focusedWindow = null;
}
]]>
</body>