Bug 948879 - Add about.js and move inline js to it from `about:` page. r=gavin, r=ttaubert
authorAfshin Mehrabani <afshin.meh@gmail.com>
Fri, 20 Dec 2013 11:37:48 -0500
changeset 171802 b463b606cf9d4724301eac88117a65799a51768e
parent 171801 42c5d19e4f5234a6bbe85d756d1f1fd94311bc33
child 171803 d7c9b80ab65fe155d4a0ed70e435f766567812ba
push id5166
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:47:54 +0000
treeherdermozilla-aurora@977eb2548b2d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, ttaubert
bugs948879
milestone29.0a1
Bug 948879 - Add about.js and move inline js to it from `about:` page. r=gavin, r=ttaubert
toolkit/content/about.js
toolkit/content/about.xhtml
toolkit/content/jar.mn
new file mode 100644
--- /dev/null
+++ b/toolkit/content/about.js
@@ -0,0 +1,32 @@
+/* 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/. */
+
+// get release notes and vendor URL from prefs
+var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
+                          .getService(Components.interfaces.nsIURLFormatter);
+var releaseNotesURL = formatter.formatURLPref("app.releaseNotesURL");
+if (releaseNotesURL != "about:blank") {
+  var relnotes = document.getElementById("releaseNotesURL");
+  relnotes.setAttribute("href", releaseNotesURL);
+  relnotes.parentNode.removeAttribute("hidden");
+}
+
+var vendorURL = formatter.formatURLPref("app.vendorURL");
+if (vendorURL != "about:blank") {
+  var vendor = document.getElementById("vendorURL");
+  vendor.setAttribute("href", vendorURL);
+}
+
+// insert the version of the XUL application (!= XULRunner platform version)
+var versionNum = Components.classes["@mozilla.org/xre/app-info;1"]
+                           .getService(Components.interfaces.nsIXULAppInfo)
+                           .version;
+var version = document.getElementById("version");
+version.textContent += " " + versionNum;
+
+// append user agent
+var ua = navigator.userAgent;
+if (ua) {
+  document.getElementById("buildID").textContent += " " + ua;
+}
--- a/toolkit/content/about.xhtml
+++ b/toolkit/content/about.xhtml
@@ -19,54 +19,23 @@
   <title>About:</title>
   <link rel="stylesheet" href="chrome://global/skin/about.css" type="text/css"/>
 </head>
 
 <body dir="&locale.dir;">
   <div id="aboutLogoContainer">
     <a id="vendorURL">
       <img src="about:logo" alt="&brandShortName;"/>
-      <p id="version"></p>
+      <p id="version">&about.version;</p>
     </a>
   </div>
 
   <ul id="aboutPageList">
     <li>&about.credits.beforeLink;<a href="about:credits">&about.credits.linkTitle;</a>&about.credits.afterLink;</li>
     <li>&about.license.beforeTheLink;<a href="about:license">&about.license.linkTitle;</a>&about.license.afterTheLink;</li>
     <li hidden="true">&about.relnotes.beforeTheLink;<a id="releaseNotesURL">&about.relnotes.linkTitle;</a>&about.relnotes.afterTheLink;</li>
     <li>&about.buildconfig.beforeTheLink;<a href="about:buildconfig">&about.buildconfig.linkTitle;</a>&about.buildconfig.afterTheLink;</li>
-    <script type="application/javascript">
-      // get release notes and vendor URL from prefs
-      var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
-                                .getService(Components.interfaces.nsIURLFormatter);
-      var releaseNotesURL = formatter.formatURLPref("app.releaseNotesURL");
-      if (releaseNotesURL != "about:blank") {
-        var relnotes = document.getElementById("releaseNotesURL");
-        relnotes.setAttribute("href", releaseNotesURL);
-        relnotes.parentNode.removeAttribute("hidden");
-      }
-
-      var vendorURL = formatter.formatURLPref("app.vendorURL");
-      if (vendorURL != "about:blank") {
-        var vendor = document.getElementById("vendorURL");
-        vendor.setAttribute("href", vendorURL);
-      }
-
-      // insert the version of the XUL application (!= XULRunner platform version)
-      var versionNum = Components.classes["@mozilla.org/xre/app-info;1"]
-                                 .getService(Components.interfaces.nsIXULAppInfo)
-                                 .version;
-      var version = document.getElementById("version");
-      version.appendChild(document.createTextNode("&about.version; " + versionNum));
-
-      // append user agent
-      var ua = navigator.userAgent;
-      if (ua) {
-        var list = document.getElementById("aboutPageList");
-        var listItem = list.appendChild(document.createElement("li"));
-        listItem.appendChild(document.createTextNode("&about.buildIdentifier;"));
-        listItem.appendChild(document.createTextNode(ua));
-      }
-    </script>
+    <li id="buildID">&about.buildIdentifier;</li>
+    <script type="application/javascript" src="chrome://global/content/about.js"/>
   </ul>
 
 </body>
 </html>
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -5,16 +5,17 @@ toolkit.jar:
 # provide the nsTransferable in nsDragAndDrop.js to extensions that have to
 # work with Geckos from before 1.9, when there was a separate file
 %  override chrome://global/content/nsTransferable.js chrome://global/content/nsDragAndDrop.js
 *  content/global/license.html                (license.html)
    content/global/XPCNativeWrapper.js         (XPCNativeWrapper.js)
 *  content/global/xul.css                     (xul.css)
    content/global/textbox.css                 (textbox.css)
    content/global/menulist.css                (menulist.css)
+   content/global/about.js                    (about.js)
    content/global/about.xhtml                 (about.xhtml)
    content/global/aboutAbout.xhtml            (aboutAbout.xhtml)
    content/global/aboutRights.xhtml           (aboutRights.xhtml)
    content/global/aboutRights-unbranded.xhtml (aboutRights-unbranded.xhtml)
    content/global/aboutNetworking.js
    content/global/aboutNetworking.xhtml
 *  content/global/aboutSupport.js
 *  content/global/aboutSupport.xhtml