Bug 1466833 - Upgrade the <xul:deck> inside of search-one-offs at the beginning of the XBL constructor;r=timdream

Right now, a XBL <constructor> runs before Custom Elements inside of its
<content> get upgraded. This leads to unexpected behavior where deck.selectedIndex = N
causes selectedIndex to get set as an expando property on the DOM node rather
than running the setter defined by the Custom Element.

Once the Custom Element does finally get upgraded, the selectedIndex getter and
setter don't get attached since there's an expando property with the same name.

This isn't a case we want to have to support from calling code. So this patch fixes
this one case by manually upgrading the element inside the constructor before
anything accesses the node. In Bug 1470242 we are planning to make this happen
behind the scenes so we don't need to do this for every CE inside of <content>.

MozReview-Commit-ID: 3D0QbOOJvDI

--HG--
extra : rebase_source : 1287445f2740dfe6a3ed5bdf273bb2b4b91b213c
This commit is contained in:
Brian Grinstead 2018-06-21 17:31:41 -07:00
parent b9a40e754b
commit c7f5ea7a6d

View File

@ -1291,6 +1291,10 @@
<field name="_contextEngine">null</field>
<constructor><![CDATA[
// Force the <deck> Custom Element to be constructed. This can be removed
// once Bug 1470242 makes this happen behind the scenes.
customElements.upgrade(this.header);
// Prevent popup events from the context menu from reaching the autocomplete
// binding (or other listeners).
let menu = document.getAnonymousElementByAttribute(this, "anonid", "search-one-offs-context-menu");