Backed out 3 changesets (bug 1388134) for crashes on [@ nsXPCWrappedJS::CallMethod(unsigned short, nsXPTMethodInfo const*, nsXPTCMiniVariant*)]. CLOSED TREE
authorNarcis Beleuzu <nbeleuzu@mozilla.com>
Mon, 01 Oct 2018 21:03:19 +0300
changeset 494768 017a4a49c716dd20134ad8ee2009bb988296585f
parent 494767 0032519e19e8838edfad2157acf3a4589cdeb52a
child 494769 fac0c84719b7184da4d04e11f2d6e2c629327fe3
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1388134
milestone64.0a1
backs out365ac2b9486fdff60e9362012a6bbb13ce80a5c5
aeb38f1ace8d5f278d0e436e8dcfc68dc9da07c8
238ec26bef308495ac182b6b66dc5cb6803ea5b4
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
Backed out 3 changesets (bug 1388134) for crashes on [@ nsXPCWrappedJS::CallMethod(unsigned short, nsXPTMethodInfo const*, nsXPTCMiniVariant*)]. CLOSED TREE Backed out changeset 365ac2b9486f (bug 1388134) Backed out changeset aeb38f1ace8d (bug 1388134) Backed out changeset 238ec26bef30 (bug 1388134)
dom/system/OSFileConstants.cpp
toolkit/components/crashes/CrashManager.jsm
toolkit/components/crashes/tests/xpcshell/test_crash_manager.js
toolkit/components/osfile/modules/osfile_async_front.jsm
toolkit/crashreporter/test/unit/test_event_files.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
--- a/dom/system/OSFileConstants.cpp
+++ b/dom/system/OSFileConstants.cpp
@@ -97,24 +97,58 @@ StaticRefPtr<OSFileConstantsService> gIn
 
 struct
 OSFileConstantsService::Paths
 {
   /**
    * The name of the directory holding all the libraries (libxpcom, libnss, etc.)
    */
   nsString libDir;
+  nsString tmpDir;
   nsString profileDir;
   nsString localProfileDir;
+  /**
+   * The user's home directory
+   */
+  nsString homeDir;
+  /**
+   * The user's 'application data' directory.
+   * Windows:
+   *   HOME = Documents and Settings\$USER\Application Data
+   *   UAppData = $HOME[\$vendor]\$name
+   *
+   * Unix:
+   *   HOME = ~
+   *   UAppData = $HOME/.[$vendor/]$name
+   *
+   * Mac:
+   *   HOME = ~
+   *   UAppData = $HOME/Library/Application Support/$name
+   */
+  nsString userApplicationDataDir;
+
+#if defined(XP_MACOSX)
+  /**
+   * The user's Library directory.
+   */
+  nsString macUserLibDir;
+#endif // defined(XP_MACOSX)
 
   Paths()
   {
     libDir.SetIsVoid(true);
+    tmpDir.SetIsVoid(true);
     profileDir.SetIsVoid(true);
     localProfileDir.SetIsVoid(true);
+    homeDir.SetIsVoid(true);
+    userApplicationDataDir.SetIsVoid(true);
+
+#if defined(XP_MACOSX)
+    macUserLibDir.SetIsVoid(true);
+#endif // defined(XP_MACOSX)
   }
 };
 
 /**
  * Return the path to one of the special directories.
  *
  * @param aKey The key to the special directory (e.g. "TmpD", "ProfD", ...)
  * @param aOutPath The path to the special directory. In case of error,
@@ -212,16 +246,27 @@ OSFileConstantsService::InitOSFileConsta
       return rv;
     }
     rv = obsService->AddObserver(this, "profile-do-change", false);
     if (NS_FAILED(rv)) {
       return rv;
     }
   }
 
+  // For other directories, ignore errors (they may be undefined on
+  // some platforms or in non-Firefox embeddings of Gecko).
+
+  GetPathToSpecialDir(NS_OS_TEMP_DIR, paths->tmpDir);
+  GetPathToSpecialDir(NS_OS_HOME_DIR, paths->homeDir);
+  GetPathToSpecialDir(XRE_USER_APP_DATA_DIR, paths->userApplicationDataDir);
+
+#if defined(XP_MACOSX)
+  GetPathToSpecialDir(NS_MAC_USER_LIB_DIR, paths->macUserLibDir);
+#endif // defined(XP_MACOSX)
+
   mPaths = std::move(paths);
 
   // Get the umask from the system-info service.
   // The property will always be present, but it will be zero on
   // non-Unix systems.
   // nsSystemInfo::gUserUmask is initialized by NS_InitXPCOM2 so we don't need
   // to initialize the service.
   mUserUmask = nsSystemInfo::gUserUmask;
@@ -869,28 +914,46 @@ OSFileConstantsService::DefineOSFileCons
   if (!SetStringProperty(aCx, objPath, "libxul", libxul)) {
     return false;
   }
 
   if (!SetStringProperty(aCx, objPath, "libDir", mPaths->libDir)) {
     return false;
   }
 
+  if (!SetStringProperty(aCx, objPath, "tmpDir", mPaths->tmpDir)) {
+    return false;
+  }
+
   // Configure profileDir only if it is available at this stage
   if (!mPaths->profileDir.IsVoid()
     && !SetStringProperty(aCx, objPath, "profileDir", mPaths->profileDir)) {
     return false;
   }
 
   // Configure localProfileDir only if it is available at this stage
   if (!mPaths->localProfileDir.IsVoid()
     && !SetStringProperty(aCx, objPath, "localProfileDir", mPaths->localProfileDir)) {
     return false;
   }
 
+  if (!SetStringProperty(aCx, objPath, "homeDir", mPaths->homeDir)) {
+    return false;
+  }
+
+  if (!SetStringProperty(aCx, objPath, "userApplicationDataDir", mPaths->userApplicationDataDir)) {
+    return false;
+  }
+
+#if defined(XP_MACOSX)
+  if (!SetStringProperty(aCx, objPath, "macUserLibDir", mPaths->macUserLibDir)) {
+    return false;
+  }
+#endif // defined(XP_MACOSX)
+
   // sqlite3 is linked from different places depending on the platform
   nsAutoString libsqlite3;
 #if defined(ANDROID)
   // On Android, we use the system's libsqlite3
   libsqlite3.AppendLiteral(MOZ_DLL_PREFIX);
   libsqlite3.AppendLiteral("sqlite3");
   libsqlite3.AppendLiteral(MOZ_DLL_SUFFIX);
 #elif defined(XP_WIN)
--- a/toolkit/components/crashes/CrashManager.jsm
+++ b/toolkit/components/crashes/CrashManager.jsm
@@ -108,32 +108,47 @@ function parseAndRemoveField(obj, field)
  *   storeDir (string)
  *     Directory we will use for our data store. This instance will write
  *     data files into the directory specified.
  *
  *   telemetryStoreSizeKey (string)
  *     Telemetry histogram to report store size under.
  */
 var CrashManager = function(options) {
+  for (let k of ["pendingDumpsDir", "submittedDumpsDir", "eventsDirs",
+    "storeDir"]) {
+    if (!(k in options)) {
+      throw new Error("Required key not present in options: " + k);
+    }
+  }
+
   this._log = Log.repository.getLogger("Crashes.CrashManager");
 
   for (let k in options) {
-    let value = options[k];
+    let v = options[k];
 
     switch (k) {
       case "pendingDumpsDir":
+        this._pendingDumpsDir = v;
+        break;
+
       case "submittedDumpsDir":
+        this._submittedDumpsDir = v;
+        break;
+
       case "eventsDirs":
+        this._eventsDirs = v;
+        break;
+
       case "storeDir":
-        let key = "_" + k;
-        delete this[key];
-        Object.defineProperty(this, key, {value});
+        this._storeDir = v;
         break;
+
       case "telemetryStoreSizeKey":
-        this._telemetryStoreSizeKey = value;
+        this._telemetryStoreSizeKey = v;
         break;
 
       default:
         throw new Error("Unknown property in options: " + k);
     }
   }
 
   // Promise for in-progress aggregation operation. We store it on the
@@ -201,57 +216,16 @@ this.CrashManager.prototype = Object.fre
   // The following are return codes for individual event file processing.
   // File processed OK.
   EVENT_FILE_SUCCESS: "ok",
   // The event appears to be malformed.
   EVENT_FILE_ERROR_MALFORMED: "malformed",
   // The type of event is unknown.
   EVENT_FILE_ERROR_UNKNOWN_EVENT: "unknown-event",
 
-  _lazyGetDir(field, path, leaf) {
-    delete this[field];
-    let value = OS.Path.join(path, leaf);
-    Object.defineProperty(this, field, { value });
-    return value;
-  },
-
-  get _crDir() {
-    return this._lazyGetDir("_crDir",
-                            OS.Constants.Path.userApplicationDataDir,
-                            "Crash Reports");
-  },
-
-  get _storeDir() {
-    return this._lazyGetDir("_storeDir",
-                            OS.Constants.Path.profileDir,
-                            "crashes");
-  },
-
-  get _pendingDumpsDir() {
-    return this._lazyGetDir("_pendingDumpsDir",
-                            this._crDir,
-                            "pending");
-  },
-
-  get _submittedDumpsDir() {
-    return this._lazyGetDir("_submittedDumpsDir",
-                            this._crDir,
-                            "submitted");
-  },
-
-  get _eventsDirs() {
-    delete this._eventsDirs;
-    let value = [
-      OS.Path.join(this._crDir, "events"),
-      OS.Path.join(this._storeDir, "events"),
-    ];
-    Object.defineProperty(this, "_eventsDirs", { value });
-    return value;
-  },
-
   /**
    * Obtain a list of all dumps pending upload.
    *
    * The returned value is a promise that resolves to an array of objects
    * on success. Each element in the array has the following properties:
    *
    *   id (string)
    *      The ID of the crash (a UUID).
@@ -1451,17 +1425,25 @@ CrashRecord.prototype = Object.freeze({
  * CrashManager is likely only ever instantiated once per application lifetime.
  * The main reason it's implemented as a reusable type is to facilitate testing.
  */
 XPCOMUtils.defineLazyGetter(this.CrashManager, "Singleton", function() {
   if (gCrashManager) {
     return gCrashManager;
   }
 
+  let crPath = OS.Path.join(OS.Constants.Path.userApplicationDataDir,
+                            "Crash Reports");
+  let storePath = OS.Path.join(OS.Constants.Path.profileDir, "crashes");
+
   gCrashManager = new CrashManager({
+    pendingDumpsDir: OS.Path.join(crPath, "pending"),
+    submittedDumpsDir: OS.Path.join(crPath, "submitted"),
+    eventsDirs: [OS.Path.join(crPath, "events"), OS.Path.join(storePath, "events")],
+    storeDir: storePath,
     telemetryStoreSizeKey: "CRASH_STORE_COMPRESSED_BYTES",
   });
 
   // Automatically aggregate event files shortly after startup. This
   // ensures it happens with some frequency.
   //
   // There are performance considerations here. While this is doing
   // work and could negatively impact performance, the amount of work
--- a/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js
+++ b/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js
@@ -32,17 +32,17 @@ add_task(async function test_constructor
     storeDir: "/baz",
   });
   Assert.ok(m, "CrashManager can be created.");
 });
 
 add_task(async function test_constructor_invalid() {
   Assert.throws(() => {
     new CrashManager({foo: true});
-  }, /Unknown property in options/);
+  }, /Required key not present in options/);
 });
 
 add_task(async function test_get_manager() {
   let m = await getManager();
   Assert.ok(m, "CrashManager obtained.");
 
   await m.createDummyDump(true);
   await m.createDummyDump(false);
--- a/toolkit/components/osfile/modules/osfile_async_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_async_front.jsm
@@ -81,19 +81,16 @@ function lazyPathGetter(constProp, dirKe
 
 for (let [constProp, dirKey] of [
   ["localProfileDir", "ProfLD"],
   ["profileDir", "ProfD"],
   ["userApplicationDataDir", "UAppData"],
   ["winAppDataDir", "AppData"],
   ["winLocalAppDataDir", "LocalAppData"],
   ["winStartMenuProgsDir", "Progs"],
-  ["tmpDir", "TmpD"],
-  ["homeDir", "Home"],
-  ["macUserLibDir", "ULibDir"],
   ]) {
 
   if (constProp in SharedAll.Constants.Path) {
     continue;
   }
 
   LOG("Installing lazy getter for OS.Constants.Path." + constProp +
       " because it isn't defined and profile may not be loaded.");
--- a/toolkit/crashreporter/test/unit/test_event_files.js
+++ b/toolkit/crashreporter/test/unit/test_event_files.js
@@ -23,17 +23,17 @@ add_task(async function test_main_proces
         let scope = {};
         ChromeUtils.import("resource://gre/modules/TelemetryController.jsm", scope);
         scope.TelemetryController.testSetup();
         crashType = CrashTestUtils.CRASH_MOZ_CRASH;
         crashReporter.annotateCrashReport("ShutdownProgress", "event-test");
       },
       (minidump, extra) => {
         basename = minidump.leafName;
-        Object.defineProperty(cm, "_eventsDirs", {value: [getEventDir()]});
+        cm._eventsDirs = [getEventDir()];
         cm.aggregateEventsFiles().then(resolve, reject);
       },
       true);
 
   });
   Assert.equal(count, 1, "A single crash event file was seen.");
   let crashes = await cm.getCrashes();
   Assert.equal(crashes.length, 1);
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -213,17 +213,16 @@ tags = blocklist
 fail-if = os == "android"
 [test_strictcompatibility.js]
 [test_switch_os.js]
 # Bug 1246231
 skip-if = os == "mac" && debug
 [test_syncGUID.js]
 [test_system_allowed.js]
 [test_system_delay_update.js]
-skip-if = true # Bug 1495021
 [test_system_repository.js]
 [test_system_reset.js]
 [test_system_update_blank.js]
 [test_system_update_checkSizeHash.js]
 [test_system_update_custom.js]
 [test_system_update_empty.js]
 skip-if = true # Failing intermittently due to a race condition in the test, see bug 1348981
 [test_system_update_enterprisepolicy.js]