Bug 1466833 - Upgrade the <xul:deck> inside of search-one-offs at the beginning of the XBL constructor;r=timdream
authorBrian Grinstead <bgrinstead@mozilla.com>
Thu, 21 Jun 2018 17:31:41 -0700
changeset 477557 78d2486268ba577408a71b1da20780229ac1d570
parent 477556 5fc9867c3330478b36b0262deb4df7cac949e9a2
child 477558 030a5574e69b0a0c093991690815888db1c0c963
push id9385
push userdluca@mozilla.com
push dateFri, 22 Jun 2018 15:47:18 +0000
treeherdermozilla-beta@82a9a1027e2b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstimdream
bugs1466833, 1470242
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
browser/components/search/content/search.xml
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -1286,16 +1286,20 @@
         ]]></getter>
       </property>
 
       <!-- When a context menu is opened on a one-off button, this is set to the
            engine of that button for use with the context menu actions. -->
       <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");
         let listener = aEvent => aEvent.stopPropagation();
         menu.addEventListener("popupshowing", listener);
         menu.addEventListener("popuphiding", listener);
         menu.addEventListener("popupshown", aEvent => {
           this._ignoreMouseEvents = true;