Bug 976241 - Create crash store directory; r=Yoric
authorGregory Szorc <gps@mozilla.com>
Tue, 04 Mar 2014 16:21:11 -0800
changeset 191195 dfb1952434d378c7936580aeefa3addeb5278c88
parent 191194 fc9096b43f0b02ff2a61ca7f1eb356bb0fece3f6
child 191196 ece9cdfb15d771b1f8f391aa6133767ebfae9280
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs976241
milestone30.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 976241 - Create crash store directory; r=Yoric
toolkit/components/crashes/CrashManager.jsm
toolkit/components/crashes/CrashManagerTest.jsm
--- a/toolkit/components/crashes/CrashManager.jsm
+++ b/toolkit/components/crashes/CrashManager.jsm
@@ -457,16 +457,21 @@ this.CrashManager.prototype = Object.fre
 
       return entries;
     }.bind(this));
   },
 
   _getStore: function () {
     return Task.spawn(function* () {
       if (!this._store) {
+        yield OS.File.makeDir(this._storeDir, {
+          ignoreExisting: true,
+          unixMode: OS.Constants.libc.S_IRWXU,
+        });
+
         let store = new CrashStore(this._storeDir, this._telemetryStoreSizeKey);
         yield store.load();
 
         this._store = store;
         this._storeTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
       }
 
       // The application can go long periods without interacting with the
--- a/toolkit/components/crashes/CrashManagerTest.jsm
+++ b/toolkit/components/crashes/CrashManagerTest.jsm
@@ -129,31 +129,39 @@ this.TestingCrashManager.prototype = {
 
 let DUMMY_DIR_COUNT = 0;
 
 this.getManager = function () {
   return Task.spawn(function* () {
     const dirMode = OS.Constants.libc.S_IRWXU;
     let baseFile = OS.Constants.Path.profileDir;
 
-    function makeDir() {
+    function makeDir(create=true) {
       return Task.spawn(function* () {
         let path = OS.Path.join(baseFile, "dummy-dir-" + DUMMY_DIR_COUNT++);
+
+        if (!create) {
+          return path;
+        }
+
         dump("Creating directory: " + path + "\n");
         yield OS.File.makeDir(path, {unixMode: dirMode});
 
         return path;
       });
     }
 
     let pendingD = yield makeDir();
     let submittedD = yield makeDir();
     let eventsD1 = yield makeDir();
     let eventsD2 = yield makeDir();
-    let storeD = yield makeDir();
+
+    // Store directory is created at run-time if needed. Ensure those code
+    // paths are triggered.
+    let storeD = yield makeDir(false);
 
     let m = new TestingCrashManager({
       pendingDumpsDir: pendingD,
       submittedDumpsDir: submittedD,
       eventsDirs: [eventsD1, eventsD2],
       storeDir: storeD,
     });