Bug 1047713, fix leak of SelectParentHelper, r=felipe

This commit is contained in:
Neil Deakin 2015-06-05 08:33:29 -04:00
parent 981147060c
commit 1d51395f1b

View File

@ -47,6 +47,8 @@
<field name="_controller">null</field> <field name="_controller">null</field>
<field name="_selectParentHelper">null</field>
<field name="_remoteWebNavigation">null</field> <field name="_remoteWebNavigation">null</field>
<property name="webNavigation" <property name="webNavigation"
@ -307,10 +309,14 @@
break; break;
case "Forms:ShowDropDown": { case "Forms:ShowDropDown": {
Cu.import("resource://gre/modules/SelectParentHelper.jsm"); if (!this._selectParentHelper) {
this._selectParentHelper =
Cu.import("resource://gre/modules/SelectParentHelper.jsm", {}).SelectParentHelper;
}
let menulist = document.getElementById(this.getAttribute("selectmenulist")); let menulist = document.getElementById(this.getAttribute("selectmenulist"));
SelectParentHelper.populate(menulist, data.options, data.selectedIndex); this._selectParentHelper.populate(menulist, data.options, data.selectedIndex);
SelectParentHelper.open(this, menulist, data.rect); this._selectParentHelper.open(this, menulist, data.rect);
break; break;
} }
@ -338,9 +344,10 @@
} }
case "Forms:HideDropDown": { case "Forms:HideDropDown": {
Cu.import("resource://gre/modules/SelectParentHelper.jsm"); if (this._selectParentHelper) {
let menulist = document.getElementById(this.getAttribute("selectmenulist")); let menulist = document.getElementById(this.getAttribute("selectmenulist"));
SelectParentHelper.hide(menulist); this._selectParentHelper.hide(menulist);
}
break; break;
} }