Bug 1495622 - Conver wizardpage binding to Custom Elements, r=paolo
authorAlexander Surkov <surkov.alexander@gmail.com>
Wed, 06 Mar 2019 10:27:25 -0500
changeset 520619 62fac4388d24a131fb8a3637be9f87e44fd86e82
parent 520478 1f10307fec284c52fbaf8d8423b47e762b9f0990
child 520620 e996f385103a9f81aa5d0a7f1f7ac1a065404dde
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1495622
milestone67.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 1495622 - Conver wizardpage binding to Custom Elements, r=paolo
toolkit/content/customElements.js
toolkit/content/jar.mn
toolkit/content/widgets/wizard.js
toolkit/content/widgets/wizard.xml
toolkit/content/xul.css
--- a/toolkit/content/customElements.js
+++ b/toolkit/content/customElements.js
@@ -510,16 +510,17 @@ if (!isDummyDocument) {
     "chrome://global/content/elements/popupnotification.js",
     "chrome://global/content/elements/radio.js",
     "chrome://global/content/elements/richlistbox.js",
     "chrome://global/content/elements/autocomplete-popup.js",
     "chrome://global/content/elements/autocomplete-richlistitem.js",
     "chrome://global/content/elements/textbox.js",
     "chrome://global/content/elements/tabbox.js",
     "chrome://global/content/elements/tree.js",
+    "chrome://global/content/elements/wizard.js",
   ]) {
     Services.scriptloader.loadSubScript(script, window);
   }
 
   for (let [tag, script] of [
     ["findbar", "chrome://global/content/elements/findbar.js"],
     ["menulist", "chrome://global/content/elements/menulist.js"],
     ["stringbundle", "chrome://global/content/elements/stringbundle.js"],
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -100,13 +100,14 @@ toolkit.jar:
    content/global/elements/marquee.js          (widgets/marquee.js)
    content/global/elements/menulist.js         (widgets/menulist.js)
    content/global/elements/popupnotification.js  (widgets/popupnotification.js)
    content/global/elements/stringbundle.js     (widgets/stringbundle.js)
    content/global/elements/tabbox.js           (widgets/tabbox.js)
    content/global/elements/textbox.js          (widgets/textbox.js)
    content/global/elements/videocontrols.js    (widgets/videocontrols.js)
    content/global/elements/tree.js             (widgets/tree.js)
+   content/global/elements/wizard.js           (widgets/wizard.js)
 #ifdef XP_MACOSX
    content/global/macWindowMenu.js
 #endif
    content/global/gmp-sources/openh264.json    (gmp-sources/openh264.json)
    content/global/gmp-sources/widevinecdm.json (gmp-sources/widevinecdm.json)
new file mode 100644
--- /dev/null
+++ b/toolkit/content/widgets/wizard.js
@@ -0,0 +1,31 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+// This is loaded into chrome windows with the subscript loader. Wrap in
+// a block to prevent accidentally leaking globals onto `window`.
+{
+class MozWizardPage extends MozXULElement {
+  connectedCallback() {
+    this.pageIndex = -1;
+  }
+  get pageid() {
+    return this.getAttribute("pageid");
+  }
+  set pageid(val) {
+    this.setAttribute("pageid", val);
+  }
+  get next() {
+    return this.getAttribute("next");
+  }
+  set next(val) {
+    this.setAttribute("next", val);
+    this.parentNode._accessMethod = "random";
+    return val;
+  }
+}
+
+customElements.define("wizardpage", MozWizardPage);
+}
--- a/toolkit/content/widgets/wizard.xml
+++ b/toolkit/content/widgets/wizard.xml
@@ -437,30 +437,16 @@
                group="system" action="this._hitEnter(event)"/>
       <handler event="keypress" keycode="VK_ESCAPE" group="system">
         if (!event.defaultPrevented)
           this.cancel();
       </handler>
     </handlers>
   </binding>
 
-  <binding id="wizardpage">
-    <implementation>
-      <field name="pageIndex">-1</field>
-
-      <property name="pageid" onget="return this.getAttribute('pageid');"
-                              onset="this.setAttribute('pageid', val);"/>
-
-      <property name="next"   onget="return this.getAttribute('next');"
-                              onset="this.setAttribute('next', val);
-                                     this.parentNode._accessMethod = 'random';
-                                     return val;"/>
-    </implementation>
-  </binding>
-
 #ifdef XP_MACOSX
   <binding id="wizard-header">
     <content>
       <xul:stack class="wizard-header-stack" flex="1">
         <xul:vbox class="wizard-header-box-1">
           <xul:vbox class="wizard-header-box-text">
             <xul:label class="wizard-header-label" xbl:inherits="xbl:text=label"/>
           </xul:vbox>
@@ -532,31 +518,31 @@
                       class="wizard-button" dlgtype="back"/>
           <xul:deck class="wizard-next-deck" anonid="WizardButtonDeck">
             <xul:hbox>
               <xul:button label="&button-finish-unix.label;" class="wizard-button"
                           dlgtype="finish" default="true" flex="1"/>
             </xul:hbox>
             <xul:hbox>
               <xul:button label="&button-next-unix.label;" accesskey="&button-next-unix.accesskey;"
-                          class="wizard-button" dlgtype="next" 
+                          class="wizard-button" dlgtype="next"
                           default="true" flex="1"/>
             </xul:hbox>
           </xul:deck>
 #else
           <xul:button label="&button-back-win.label;" accesskey="&button-back-win.accesskey;"
                       class="wizard-button" dlgtype="back"/>
           <xul:deck class="wizard-next-deck" anonid="WizardButtonDeck">
             <xul:hbox>
               <xul:button label="&button-finish-win.label;" class="wizard-button"
                           dlgtype="finish" default="true" flex="1"/>
             </xul:hbox>
             <xul:hbox>
               <xul:button label="&button-next-win.label;" accesskey="&button-next-win.accesskey;"
-                          class="wizard-button" dlgtype="next" 
+                          class="wizard-button" dlgtype="next"
                           default="true" flex="1"/>
             </xul:hbox>
           </xul:deck>
           <xul:button label="&button-cancel-win.label;" class="wizard-button"
                       dlgtype="cancel"/>
 #endif
         </xul:hbox>
       </xul:vbox>
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -668,17 +668,16 @@ wizard,
 wizard:root /* override :root from above */ {
   -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizard");
   -moz-box-orient: vertical;
   width: 40em;
   height: 30em;
 }
 
 wizardpage {
-  -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizardpage");
   -moz-box-orient: vertical;
   overflow: auto;
 }
 
 .wizard-header {
   -moz-binding: url("chrome://global/content/bindings/wizard.xml#wizard-header");
 }