Bug 872206 - Part 1 - Create a separate CrashMonitor file for Metro. r=dteller.
authorMarina Samuel <msamuel@mozilla.com>
Wed, 12 Feb 2014 12:59:11 -0500
changeset 168359 c0ea0b4d69f7750002c5bed54219f7296f2536ac
parent 168358 dfde6f7df7f5965b2f5c3656c58ab53bd0942139
child 168360 77e7f75b502d7f0dc21377d7d358d8002096e5e0
push id5034
push usermsamuel@mozilla.com
push dateWed, 12 Feb 2014 18:00:36 +0000
treeherderfx-team@77e7f75b502d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdteller
bugs872206
milestone30.0a1
Bug 872206 - Part 1 - Create a separate CrashMonitor file for Metro. r=dteller.
toolkit/components/crashmonitor/CrashMonitor.jsm
--- a/toolkit/components/crashmonitor/CrashMonitor.jsm
+++ b/toolkit/components/crashmonitor/CrashMonitor.jsm
@@ -81,19 +81,23 @@ let CrashMonitorInternal = {
 
   /* Deferred for AsyncShutdown blocker */
   profileBeforeChangeDeferred: Promise.defer(),
 
   /**
    * Path to checkpoint file.
    *
    * Each time a new notification is received, this file is written to
-   * disc to reflect the information in |checkpoints|.
+   * disc to reflect the information in |checkpoints|. Although Firefox for
+   * Desktop and Metro share the same profile, they need to keep record of
+   * crashes separately.
    */
-  path: OS.Path.join(OS.Constants.Path.profileDir, "sessionCheckpoints.json"),
+  path: (Services.metro && Services.metro.immersive) ?
+    OS.Path.join(OS.Constants.Path.profileDir, "metro", "sessionCheckpoints.json"):
+    OS.Path.join(OS.Constants.Path.profileDir, "sessionCheckpoints.json"),
 
   /**
    * Load checkpoints from previous session asynchronously.
    *
    * @return {Promise} A promise that resolves/rejects once loading is complete
    */
   loadPreviousCheckpoints: function () {
     let deferred = Promise.defer();
@@ -176,16 +180,17 @@ this.CrashMonitor = {
 
     // Add shutdown blocker for profile-before-change
     AsyncShutdown.profileBeforeChange.addBlocker(
       "CrashMonitor: Writing notifications to file after receiving profile-before-change",
       CrashMonitorInternal.profileBeforeChangeDeferred.promise
     );
 
     CrashMonitorInternal.initialized = true;
+    OS.File.makeDir(OS.Path.join(OS.Constants.Path.profileDir, "metro"));
     return promise;
   },
 
   /**
    * Handle registered notifications.
    *
    * Update checkpoint file for every new notification received.
    */