Bug 1398136 - use startup profile dir if necessary, r?MattN draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 12 Sep 2017 17:28:41 +0100
changeset 665949 07cc27dd781d1cb5c50be4b587720367b3fd85f7
parent 665900 27e7b4261e4b5a016e09adb5332a181e43ab520e
child 731936 bedbd571e47404a83b2847e9f5fc37aed4c5ec28
push id80230
push usergijskruitbosch@gmail.com
push dateSat, 16 Sep 2017 15:57:43 +0000
reviewersMattN
bugs1398136
milestone57.0a1
Bug 1398136 - use startup profile dir if necessary, r?MattN MozReview-Commit-ID: GZPsnG3UE8G
toolkit/components/xulstore/XULStore.js
--- a/toolkit/components/xulstore/XULStore.js
+++ b/toolkit/components/xulstore/XULStore.js
@@ -56,17 +56,25 @@ XULStore.prototype = {
   _storeFile: null,
   _needsSaving: false,
   _saveAllowed: true,
   _writeTimer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
 
   load() {
     Services.obs.addObserver(this, "profile-before-change", true);
 
-    this._storeFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+    try {
+      this._storeFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+    } catch (ex) {
+      try {
+        this._storeFile = Services.dirsvc.get("ProfDS", Ci.nsIFile);
+      } catch (ex) {
+        throw new Error("Can't find profile directory.");
+      }
+    }
     this._storeFile.append(STOREDB_FILENAME);
 
     this.readFile();
   },
 
   observe(subject, topic, data) {
     this.writeFile();
     if (topic == "profile-before-change") {