about:startup - address Gavin's review comments. try: -b do -p macosx64 -m none -u all -t tp4
authorDaniel Brooks <db48x@db48x.net>
Mon, 25 Oct 2010 06:49:42 -0500
changeset 58863 bfc0fc174aa16ad0dac0ad68d2995ff8d0401a68
parent 58862 8ad67554aadd0e22451e6c740fd3061472d86655
child 58864 c6e28dd6326cdf7c76813783c896adbcc38a1e7f
push id17440
push userdb48x@yahoo.com
push dateWed, 08 Dec 2010 04:15:54 +0000
treeherdermozilla-central@a89f24bf1798 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b8pre
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
about:startup - address Gavin's review comments. try: -b do -p macosx64 -m none -u all -t tp4
toolkit/components/startup/src/nsAppStartup.cpp
toolkit/content/aboutStartup.js
toolkit/content/aboutStartup.xhtml
toolkit/content/license.html
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/themes/gnomestripe/global/aboutStartup.css
toolkit/themes/pinstripe/global/aboutStartup.css
toolkit/themes/winstripe/global/aboutStartup.css
toolkit/xre/nsAppRunner.cpp
xpcom/system/nsIXULRuntime.idl
--- a/toolkit/components/startup/src/nsAppStartup.cpp
+++ b/toolkit/components/startup/src/nsAppStartup.cpp
@@ -106,17 +106,18 @@ nsresult EnsureTable(mozIStorageConnecti
 // nsAppStartup
 //
 
 nsAppStartup::nsAppStartup() :
   mConsiderQuitStopper(0),
   mRunning(PR_FALSE),
   mShuttingDown(PR_FALSE),
   mAttemptingQuit(PR_FALSE),
-  mRestart(PR_FALSE)
+  mRestart(PR_FALSE),
+  mRestoredTimestamp(0)
 { }
 
 
 nsresult
 nsAppStartup::Init()
 {
   NS_TIME_FUNCTION;
   nsresult rv;
@@ -516,18 +517,17 @@ nsAppStartup::Observe(nsISupports *aSubj
       EnterLastWindowClosingSurvivalArea();
       CloseAllWindows();
       ExitLastWindowClosingSurvivalArea();
     }
   } else if (!strcmp(aTopic, "xul-window-registered")) {
     EnterLastWindowClosingSurvivalArea();
   } else if (!strcmp(aTopic, "xul-window-destroyed")) {
     ExitLastWindowClosingSurvivalArea();
-  } else if ((!strcmp(aTopic, "sessionstore-browser-state-restored")) ||
-             (!strcmp(aTopic, "sessionstore-windows-restored"))) {
+  } else if (!strcmp(aTopic, "sessionstore-windows-restored")) {
     RecordStartupDuration();
   } else if (!strcmp(aTopic, "AddonManager-event")) {
     RecordAddonEvent(aData, aSubject);
   } else {
     NS_ERROR("Unexpected observer topic.");
   }
 
   return NS_OK;
--- a/toolkit/content/aboutStartup.js
+++ b/toolkit/content/aboutStartup.js
@@ -9,17 +9,17 @@
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is the about:startup page.
  *
  * The Initial Developer of the Original Code is
- * Mozilla Corporation.
+ * Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2010
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Daniel Brooks <db48x@db48x.net>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -32,21 +32,20 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
+Components.utils.import("resource://gre/modules/Services.jsm");
 
-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 strings = Services.strings.createBundle("chrome://global/locale/aboutStartup.properties");
+let branding = Services.strings.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", [brandShortName, version, build]);
 function formatExtension(str, name, version) formatStr("extension"+str, [name, version]);
@@ -65,40 +64,35 @@ function major(r) color(r, "#444");
 function minor(r) color(r, "#AAA");
 function green(r) color(r, "#00F");
 function majorMark(x, l) label(major(mark(range(x))), l);
 function minorMark(x, l) label(minor(mark(range(x))), l);
 function extensionMark(x, l) label(green(mark(range(x))), l);
 
 ///// First, display the timings from the current startup
 let launched, startup, restored;
-let runtime = Cc["@mozilla.org/xre/runtime;1"].getService(Ci.nsIXULRuntime);
 
 try {
-  displayTimestamp("launched", launched = runtime.launchTimestamp);
+  displayTimestamp("launched", launched = Services.appinfo.launchTimestamp);
 } catch(x) { }
 
-displayTimestamp("started", startup = runtime.startupTimestamp);
+displayTimestamp("started", startup = Services.appinfo.startupTimestamp);
 if (launched)
   displayDuration("started", startup - launched);
 
 let app = Cc["@mozilla.org/toolkit/app-startup;1"]
             .getService(Ci.nsIAppStartup2);
 displayTimestamp("restored", restored = app.restoredTimestamp);
 displayDuration("restored", restored - startup);
 
 ///// Next, load the database
-var file = Components.classes["@mozilla.org/file/directory_service;1"]
-                     .getService(Components.interfaces.nsIProperties)
-                     .get("ProfD", Components.interfaces.nsIFile);
+var file = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
 file.append("startup.sqlite");
 
-var svc = Components.classes["@mozilla.org/storage/service;1"]
-                    .getService(Components.interfaces.mozIStorageService);
-var db = svc.openDatabase(file);
+var db = Services.storage.openDatabase(file);
 
 ///// set up the graph options
 var graph, overview;
 var options = { legend: { show: true, position: "ne", margin: 10,
                           labelBoxBorderColor: "transparent" },
                 xaxis: { mode: "time" },
                 yaxis: { min: 0, tickFormatter: formatms },
                 selection: { mode: "xy", color: "#00A" },
--- a/toolkit/content/aboutStartup.xhtml
+++ b/toolkit/content/aboutStartup.xhtml
@@ -10,17 +10,17 @@
    - Software distributed under the License is distributed on an "AS IS" basis,
    - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    - for the specific language governing rights and limitations under the
    - License.
    -
    - The Original Code is the about:startup page.
    -
    - The Initial Developer of the Original Code is
-   - the Mozilla Corporation.
+   - the Mozilla Foundation.
    - Portions created by the Initial Developer are Copyright (C) 2010
    - the Initial Developer. All Rights Reserved.
    -
    - Contributor(s):
    -   Daniel Brooks <db48x@db48x.net>
    -
    - Alternatively, the contents of this file may be used under the terms of
    - either the GNU General Public License Version 2 or later (the "GPL"), or
--- a/toolkit/content/license.html
+++ b/toolkit/content/license.html
@@ -2793,18 +2793,19 @@ WHETHER IN CONTRACT, STRICT LIABILITY, O
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 </pre>
 
     <hr>
 
     <h1><a name="jquery"></a>jQuery License</h1>
 
-    <p class="correctme">This license applies to files in the directory
-      <span class="path">mail/jquery/</span>.<br>
+    <p class="correctme">This license applies to files in the directories
+      <span class="path">mail/jquery/</span> and
+      <span class="path">toolkit/content/jquery/</span>.<br>
       Furthermore, the file <span class="path">browser/base/content/tabview/iq.js</span>
       incorporates work from jQuery.</p>
 
 <pre>
 Copyright (c) 2010 John Resig, http://jquery.com/
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -223,16 +223,18 @@ var AddonManagerInternal = {
   /**
    * Initializes the AddonManager, loading any known providers and initializing
    * them.
    */
   startup: function AMI_startup() {
     if (gStarted)
       return;
 
+    this._addNotificationListeners();
+
     let appChanged = undefined;
 
     try {
       appChanged = Services.appinfo.version !=
                    Services.prefs.getCharPref(PREF_EM_LAST_APP_VERSION);
     }
     catch (e) { }
 
@@ -867,26 +869,24 @@ var AddonManagerInternal = {
    * native code of the extension events.
    *
    * Currently only handles that subset of the events and data that
      * the about:startup page requires.
    *
    */
   _addNotificationListeners: function()
   {
-    const svc = Cc["@mozilla.org/observer-service;1"]
-                  .getService(Ci.nsIObserverService);
     function notify(msg, extension)
     {
       let bag = Cc["@mozilla.org/hash-property-bag;1"]
                   .createInstance(Ci.nsIWritablePropertyBag2);
       bag.setPropertyAsAString("id", extension.id);
       bag.setPropertyAsAString("name", extension.name);
       bag.setPropertyAsAString("version", extension.version);
-      svc.notifyObservers(bag, "AddonManager-event", msg);
+      Services.obs.notifyObservers(bag, "AddonManager-event", msg);
     }
     this.addAddonListener({ onEnabling: function(extension) { notify("Enabled", extension) },
                             onDisabling: function(extension) { notify("Disabled", extension) },
                             onInstalling: function(extension) { notify("Installed", extension) },
                             onUninstalling: function(extension) { notify("Uninstalled", extension) },
                           });
   },
 };
--- a/toolkit/themes/gnomestripe/global/aboutStartup.css
+++ b/toolkit/themes/gnomestripe/global/aboutStartup.css
@@ -1,8 +1,45 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the about:startup page.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Daniel Brooks <db48x@db48x.net>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
 h1 {
     font-size: 140%;
     margin: .5em 0;
 }
 
 #graph, #overview {
     margin: 0;
     width: 100%;
--- a/toolkit/themes/pinstripe/global/aboutStartup.css
+++ b/toolkit/themes/pinstripe/global/aboutStartup.css
@@ -1,8 +1,45 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the about:startup page.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Daniel Brooks <db48x@db48x.net>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
 h1 {
     font-size: 140%;
     margin: .5em 0;
 }
 
 #graph, #overview {
     margin: 0;
     width: 100%;
--- a/toolkit/themes/winstripe/global/aboutStartup.css
+++ b/toolkit/themes/winstripe/global/aboutStartup.css
@@ -1,8 +1,45 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the about:startup page.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Daniel Brooks <db48x@db48x.net>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
 h1 {
     font-size: 140%;
     margin: .5em 0;
 }
 
 #graph, #overview {
     margin: 0;
     width: 100%;
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -840,17 +840,17 @@ nsXULAppInfo::InvalidateCachesOnRestart(
 NS_IMETHODIMP nsXULAppInfo::GetLaunchTimestamp(PRUint64 *aTimestamp)
 {
   static PRUint64 cached = 0;
   if (cached)
   {
     *aTimestamp = cached;
     return NS_OK;
   }
-#ifdef XP_UNIX
+#if defined(XP_UNIX) && !defined(XP_MACOSX)
   FILE *uptime;
   long tickspersecond = sysconf(_SC_CLK_TCK);
   unsigned long long sec, ssec;
 
   uptime = fopen("/proc/uptime", "r");
   fscanf(uptime, "%lld.%lld", &sec, &ssec);
   PRTime boottime = PR_Now() - (((sec * PR_MSEC_PER_SEC) + (ssec * 10)) * PR_USEC_PER_MSEC);
   fclose(uptime);
@@ -887,20 +887,20 @@ NS_IMETHODIMP nsXULAppInfo::GetLaunchTim
     CopyMemory(aTimestamp, &start, sizeof(PRTime));
 #ifdef __GNUC__
     *aTimestamp = cached = (*aTimestamp - 116444736000000000LL) / 10LL;
 #else
     *aTimestamp = cached = (*aTimestamp - 116444736000000000i64) / 10i64;
 #endif    
     return NS_OK;
   }
-  return NS_ERROR_FAILURE;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
+  return NS_ERROR_FAILURE;
 }
 
 /* readonly attribute unsigned long startupTimestamp; */
 NS_IMETHODIMP nsXULAppInfo::GetStartupTimestamp(PRUint64 *aTimestamp)
 {
   *aTimestamp = gAppData->startupTimestamp;
   return NS_OK;
 }
--- a/xpcom/system/nsIXULRuntime.idl
+++ b/xpcom/system/nsIXULRuntime.idl
@@ -103,17 +103,25 @@ interface nsIXULRuntime : nsISupports
 
   /**
    * Signal the apprunner to invalidate caches on the next restart.
    * This will cause components to be autoregistered and all
    * fastload data to be re-created.
    */
   void invalidateCachesOnRestart();
 
+
+  /**
+   * Recorded timestamp indicating when the operating system began launching the app
+    */
   readonly attribute unsigned long long launchTimestamp;
+
+  /**
+   * Recorded timestamp indicating when app startup began (essentially XRE_Main)
+    */
   readonly attribute unsigned long long startupTimestamp;
 
   /**
    * Starts a child process. This method is intented to pre-start a
    * content child process so that when it is actually needed, it is
    * ready to go.
    *
    * @throw NS_ERROR_NOT_AVAILABLE if not available.