about:startup - handle application brand name and localizable extension names correctly
authorDaniel Brooks <db48x@db48x.net>
Sat, 18 Sep 2010 17:54:32 -0400
changeset 58849 9230d155978deaa4773a91c2c64f4a398ad6aaf5
parent 58848 3d74b68d15c9cd86737ad50f0276f5dedc60cd62
child 58850 201318cf1908440de996ad1977846702ad4e141f
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
milestone2.0b6pre
about:startup - handle application brand name and localizable extension names correctly
toolkit/content/aboutStartup.js
toolkit/content/aboutStartup.xhtml
toolkit/locales/en-US/chrome/global/aboutStartup.properties
--- a/toolkit/content/aboutStartup.js
+++ b/toolkit/content/aboutStartup.js
@@ -1,25 +1,23 @@
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 
 let stringsvc = Components.classes["@mozilla.org/intl/stringbundle;1"]
                           .getService(Components.interfaces.nsIStringBundleService);
 let strings = stringsvc.createBundle("chrome://global/locale/aboutStartup.properties");
 let branding = stringsvc.createBundle("chrome://branding/locale/brand.properties");
+let brandShortName = branding.GetStringFromName("brandShortName");
 
 function displayTimestamp(id, µs) document.getElementById(id).textContent = formatstamp(µs);
 function displayDuration(id, µs) document.getElementById(id).nextSibling.textContent = formatms(msFromµs(µs));
 
 function formatStr(str, args) strings.formatStringFromName("about.startup."+ str, args, args.length);
-function appVersion(version, build) formatStr("appVersion",
-                                              [branding.getStringFromName("brandShortName"),
-//                                              ["Firefox",
-                                               version, build]);
-function formatExtension(str, id, version) formatStr("extension"+str, [id, version]);
+function appVersion(version, build) formatStr("appVersion", [brandShortName, version, build]);
+function formatExtension(str, name, version) formatStr("extension"+str, [name, version]);
 
 function msFromµs(µs) µs / 1000;
 function formatstamp(µs) new Date(msFromµs(µs));
 function formatµs(µs) µs + " µs";
 function formatms(ms) formatStr("milliseconds", [ms]);
 
 function point(stamp, µs, v, b) [msFromµs(stamp), msFromµs(µs), { appVersion: v, appBuild: b }];
 function range(a, b) ({ from: msFromµs(a), to: msFromµs(b || a) });
@@ -203,36 +201,40 @@ function populateEvents()
 {
   var query = db.createStatement("SELECT timestamp, id, name, version, action FROM events");
   let lastver, lastbuild;
   let hasresults;
 
   query.executeAsync({
     handleResult: function(results)
     {
-      let table = document.getElementById("events-table");
-      for (let row = results.getNextRow(); row; row = results.getNextRow())
+      Application.getExtensions(function (extensions)
       {
-        hasresults = true;
-        let stamp = row.getResultByName("timestamp"),
-            id = row.getResultByName("id"),
-            name = row.getResultByName("name"),
-            version = row.getResultByName("version"),
-            action = row.getResultByName("action");
+        let table = document.getElementById("events-table");
+        for (let row = results.getNextRow(); row; row = results.getNextRow())
+        {
+          hasresults = true;
+          let stamp = row.getResultByName("timestamp"),
+              id = row.getResultByName("id"),
+              extension = extensions.get(id),
+              name = extension ? extension.name : row.getResultByName("name"),
+              version = row.getResultByName("version"),
+              action = row.getResultByName("action");
+          alert([id, name, row.getResultByName("name")].toSource());
+          options.grid.markings.push(extensionMark(stamp, formatExtension(action, name, version)));
 
-        options.grid.markings.push(extensionMark(stamp, formatExtension(action, name, version)));
-
-        table.appendChild(tr(td(formatstamp(stamp)),
-                             td(action),
-                             td(name),
-                             td(id),
-                             td(version)));
-      }
-      if (hasresults)
-        $("#events-table > .empty").hide();
+          table.appendChild(tr(td(formatstamp(stamp)),
+                               td(action),
+                               td(name),
+                               td(id),
+                               td(version)));
+        }
+        if (hasresults)
+          $("#events-table > .empty").hide();
+      });
     },
     handleError: function(error)
     {
       $("#events-table").appendChild(tr(td("Error: "+ error.message +" ("+ error.result +")")));
     },
     handleCompletion: function()
     {
       graph = $.plot($("#graph"), series, options);
--- a/toolkit/content/aboutStartup.xhtml
+++ b/toolkit/content/aboutStartup.xhtml
@@ -53,14 +53,14 @@
       <table id="events-table">
         <tr>
           <th>&about.startup.timestamp;</th>
           <th>&about.startup.action;</th>
           <th>&about.startup.extension;</th>
           <th>&about.startup.extensionID;</th>
           <th>&about.startup.version;</th>
         </tr>
-        <tr class="empty"><td colspan="2"><i>&about.startup.noevents;</i></td></tr>
+        <tr class="empty"><td colspan="5"><i>&about.startup.noevents;</i></td></tr>
       </table>
     </div>
     <script type="application/javascript;version=1.8" src="chrome://global/content/aboutStartup.js"/>
   </body>
 </html>
--- a/toolkit/locales/en-US/chrome/global/aboutStartup.properties
+++ b/toolkit/locales/en-US/chrome/global/aboutStartup.properties
@@ -1,22 +1,22 @@
 # LOCALIZATION NOTE (about.startup.appVersion): %1$S will be
 # &brandShortName;, %2$S will be the version number, and %$S3 will be
 # the Gecko build id. ex: "Firefox 4.0b6pre (20100909051952)"
 about.startup.appVersion=%1$S %2$S (%3$S)
 # LOCALIZATION NOTE (about.startup.extensionInstalled): %1$S will be
 # the name of an extension, and %2$S will be its version number
-about.startup.extensionInstalled=%1$S %1$2 installed
+about.startup.extensionInstalled=%1$S %2$S installed
 # LOCALIZATION NOTE (about.startup.extensionUninstalled): %1$S will be
 # the name of an extension, and %2$S will be its version number
-about.startup.extensionUninstalled=%1$S %1$2 uninstalled
+about.startup.extensionUninstalled=%1$S %2$S uninstalled
 # LOCALIZATION NOTE (about.startup.extensionUpgraded): %1$S will be
 # the name of an extension, and %2$S will be its version number
-about.startup.extensionUpgraded=%1$S upgraded to %1$2
+about.startup.extensionUpgraded=%1$S upgraded to %2$S
 # LOCALIZATION NOTE (about.startup.extensionEnabled): %1$S will be the
 # name of an extension, and %2$S will be its version number
-about.startup.extensionEnabled=%1$S %1$2 enabled
+about.startup.extensionEnabled=%1$S %2$S enabled
 # LOCALIZATION NOTE (about.startup.extensionDisabled): %1$S will be
 # the name of an extension, and %2$S will be its version number
-about.startup.extensionDisabled=%1$S %1$2 disabled
+about.startup.extensionDisabled=%1$S %2$S disabled
 # LOCALIZATION NOTE (about.startup.milliseconds): formats a number
 # (%1$S) as milliseconds
 about.startup.milliseconds=%1$S ms