Bug 1545962 - Use <template> instead of CDATA for about:preferences r=Gijs
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 22 Apr 2019 22:38:57 +0000
changeset 470421 8ce092764f601dc1d02c2f7a779ff405796b1b03
parent 470420 496a04e97a17f481899ea873155294cd3da55ea2
child 470422 8b552b0169ac49cab72e9aebeb15a2b87d35055b
push id35905
push userdvarga@mozilla.com
push dateTue, 23 Apr 2019 09:53:27 +0000
treeherdermozilla-central@831918f009f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1545962
milestone68.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 1545962 - Use <template> instead of CDATA for about:preferences r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D28280
browser/components/preferences/in-content/home.xul
browser/components/preferences/in-content/main.xul
browser/components/preferences/in-content/preferences.js
browser/components/preferences/in-content/privacy.xul
browser/components/preferences/in-content/search.xul
browser/components/preferences/in-content/sync.xul
--- a/browser/components/preferences/in-content/home.xul
+++ b/browser/components/preferences/in-content/home.xul
@@ -1,17 +1,17 @@
 # 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/.
 
 <!-- Home panel -->
 
 <script type="application/javascript"
         src="chrome://browser/content/preferences/in-content/home.js"/>
-<box id="template-paneHome" hidden="true"><![CDATA[
+<html:template id="template-paneHome">
 <hbox id="firefoxHomeCategory"
       class="subcategory"
       hidden="true"
       data-category="paneHome">
   <html:h1 style="-moz-box-flex: 1;" data-l10n-id="pane-home-title"/>
   <button id="restoreDefaultHomePageBtn"
           class="homepage-button check-home-page-controlled"
           data-preference-related="browser.startup.homepage"
@@ -93,9 +93,9 @@
   <hbox id="browserNewTabExtensionContent"
         align="center" hidden="true" class="extension-controlled">
     <description control="disableNewTabExtension" flex="1" />
     <button id="disableNewTabExtension"
             class="extension-controlled-button accessory-button"
             data-l10n-id="disable-extension" />
   </hbox>
 </groupbox>
-]]></box>
+</html:template>
--- a/browser/components/preferences/in-content/main.xul
+++ b/browser/components/preferences/in-content/main.xul
@@ -11,17 +11,17 @@
   <script type="application/javascript" src="chrome://browser/content/aboutDialog-appUpdater.js"/>
 #endif
 
 <script type="application/javascript"
         src="chrome://mozapps/content/preferences/fontbuilder.js"/>
 
 <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences.properties"/>
 
-<box id="template-paneGeneral" hidden="true"><![CDATA[
+<html:template id="template-paneGeneral">
 <hbox id="generalCategory"
       class="subcategory"
       hidden="true"
       data-category="paneGeneral">
   <html:h1 data-l10n-id="pane-general-title"/>
 </hbox>
 
 <!-- Startup -->
@@ -700,9 +700,9 @@
                 connection-proxy-autologin.label,
                 connection-proxy-socks-remote-dns.label,
                 connection-dns-over-https.label,
                 connection-dns-over-https-url-custom.label,
             " />
     </hbox>
   </hbox>
 </groupbox>
-]]></box>
+</html:template>
--- a/browser/components/preferences/in-content/preferences.js
+++ b/browser/components/preferences/in-content/preferences.js
@@ -40,20 +40,18 @@ function init_category_if_required(categ
 }
 
 function register_module(categoryName, categoryObject) {
   gCategoryInits.set(categoryName, {
     inited: false,
     async init() {
       let template = document.getElementById("template-" + categoryName);
       if (template) {
-        // Replace the template element with the nodes from the parsed comment
-        // string.
-        let frag = MozXULElement.parseXULToFragment(template.firstChild.data);
-
+        // Replace the template element with the nodes inside of it.
+        let frag = template.content;
         await document.l10n.translateFragment(frag);
 
         // Actually insert them into the DOM.
         document.l10n.pauseObserving();
         template.replaceWith(frag);
         document.l10n.resumeObserving();
 
         // Asks Preferences to update the attribute value of the entire
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -3,17 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 <!-- Privacy panel -->
 
 <script type="application/javascript"
         src="chrome://browser/content/preferences/in-content/privacy.js"/>
 <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
 <stringbundle id="signonBundle" src="chrome://passwordmgr/locale/passwordmgr.properties"/>
-<box id="template-panePrivacy" hidden="true"><![CDATA[
+<html:template id="template-panePrivacy">
 <hbox id="browserPrivacyCategory"
       class="subcategory"
       hidden="true"
       data-category="panePrivacy">
   <html:h1 data-l10n-id="privacy-header"/>
 </hbox>
 
 <!-- Tracking / Content Blocking -->
@@ -931,9 +931,9 @@
                   devmgr-button-changepw.label,
                   devmgr-button-load.label,
                   devmgr-button-unload.label
                 "/>
       </hbox>
     </vbox>
   </hbox>
 </groupbox>
-]]></box>
+</html:template>
--- a/browser/components/preferences/in-content/search.xul
+++ b/browser/components/preferences/in-content/search.xul
@@ -1,11 +1,11 @@
     <script type="application/javascript"
             src="chrome://browser/content/preferences/in-content/search.js"/>
-    <box id="template-paneSearch" hidden="true"><![CDATA[
+    <html:template id="template-paneSearch">
     <hbox id="searchCategory"
           class="subcategory"
           hidden="true"
           data-category="paneSearch">
       <html:h1 data-l10n-id="pane-search-title"/>
     </hbox>
 
     <groupbox id="searchbarGroup" data-category="paneSearch" hidden="true">
@@ -76,9 +76,9 @@
                 data-l10n-id="search-remove-engine"
                 disabled="true"
                 />
       </hbox>
       <hbox id="addEnginesBox" pack="start">
         <label id="addEngines" data-l10n-id="search-find-more-link" is="text-link"></label>
       </hbox>
     </groupbox>
-    ]]></box>
+    </html:template>
--- a/browser/components/preferences/in-content/sync.xul
+++ b/browser/components/preferences/in-content/sync.xul
@@ -1,17 +1,17 @@
 # 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/.
 
 <!-- Sync panel -->
 
 <script type="application/javascript"
         src="chrome://browser/content/preferences/in-content/sync.js"/>
-<box id="template-paneSync" hidden="true"><![CDATA[
+<html:template id="template-paneSync">
 <hbox id="firefoxAccountCategory"
       class="subcategory"
       hidden="true"
       data-category="paneSync">
   <html:h1 data-l10n-id="pane-sync-title2"/>
 </hbox>
 
 <deck id="weavePrefsDeck" data-category="paneSync" hidden="true"
@@ -191,9 +191,9 @@
              class="fxaMobilePromo" data-l10n-id="sync-manage-devices"/>
     </vbox>
     <vbox id="tosPP-small" align="start">
       <label id="tosPP-small-ToS" is="text-link" data-l10n-id="sync-tos-link"/>
       <label id="tosPP-small-PP" is="text-link" data-l10n-id="sync-fxa-privacy-notice"/>
     </vbox>
   </vbox>
 </deck>
-]]></box>
+</html:template>