Bug 1323600 - Some fields have been converted to properties and won't reset anymore when the binding is recreated. r=Mossop
MozReview-Commit-ID: CHxBFpbW6aS
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -64,41 +64,41 @@
]]></constructor>
<destructor><![CDATA[
this.inputField.controllers.removeController(this._pasteController);
]]></destructor>
<!-- =================== nsIAutoCompleteInput =================== -->
+ <field name="_popup">null</field>
<property name="popup" readonly="true">
<getter><![CDATA[
+ // Memoize the result in a field rather than replacing this property,
+ // so that it can be reset along with the binding.
+ if (this._popup) {
+ return this._popup;
+ }
+
let popup = null;
let popupId = this.getAttribute("autocompletepopup");
if (popupId) {
popup = document.getElementById(popupId);
}
if (!popup) {
popup = document.createElement("panel");
popup.setAttribute("type", "autocomplete");
popup.setAttribute("noautofocus", "true");
let popupset = document.getAnonymousElementByAttribute(this, "anonid", "popupset");
popupset.appendChild(popup);
}
popup.mInput = this;
- // Avoid having to recalculate the popup property each time
- Object.defineProperty(this, "popup", {
- configurable: true,
- enumerable: true,
- writable: true,
- value: popup
- });
- return popup;
+ return this._popup = popup;
]]></getter>
</property>
<property name="controller" onget="return this.mController;" readonly="true"/>
<property name="popupOpen"
onget="return this.popup.popupOpen;"
onset="if (val) this.openPopup(); else this.closePopup();"/>
--- a/toolkit/content/widgets/tabbox.xml
+++ b/toolkit/content/widgets/tabbox.xml
@@ -344,34 +344,34 @@
break;
}
}
return val;
]]>
</setter>
</property>
+ <field name="_tabbox">null</field>
<property name="tabbox" readonly="true">
<getter><![CDATA[
+ // Memoize the result in a field rather than replacing this property,
+ // so that it can be reset along with the binding.
+ if (this._tabbox) {
+ return this._tabbox;
+ }
+
let parent = this.parentNode;
while (parent) {
if (parent.localName == "tabbox") {
break;
}
parent = parent.parentNode;
}
- // Avoid having to recalculate the tabbox property each time
- Object.defineProperty(this, "tabbox", {
- configurable: true,
- enumerable: true,
- writable: true,
- value: parent
- });
- return parent;
+ return this._tabbox = parent;
]]></getter>
</property>
<!-- _tabbox is deprecated, it exists only for backwards compatibility. -->
<field name="_tabbox" readonly="true"><![CDATA[
this.tabbox;
]]></field>
@@ -639,34 +639,34 @@
}
return tabElmFromIndex;
]]>
</body>
</method>
<!-- public -->
+ <field name="_tabbox">null</field>
<property name="tabbox" readonly="true">
<getter><![CDATA[
+ // Memoize the result in a field rather than replacing this property,
+ // so that it can be reset along with the binding.
+ if (this._tabbox) {
+ return this._tabbox;
+ }
+
let parent = this.parentNode;
while (parent) {
if (parent.localName == "tabbox") {
break;
}
parent = parent.parentNode;
}
- // Avoid having to recalculate the tabbox property each time
- Object.defineProperty(this, "tabbox", {
- configurable: true,
- enumerable: true,
- writable: true,
- value: parent
- });
- return parent;
+ return this._tabbox = parent;
]]></getter>
</property>
<field name="_selectedPanel">this.childNodes.item(this.selectedIndex)</field>
<property name="selectedIndex">
<getter>
<![CDATA[