summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/test/unit/test_crashreporter_crash_profile_lock.js
blob: 78492ea5de80ca4564eec7d5e87e34a613786d64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function run_test()
{
  if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
    dump("INFO | test_crashreporter.js | Can't test crashreporter in a non-libxul build.\n");
    return;
  }

  // lock a profile directory, crash, and ensure that
  // the profile lock signal handler doesn't interfere with
  // writing a minidump
  do_crash(function() {
             let env = Components.classes["@mozilla.org/process/environment;1"]
               .getService(Components.interfaces.nsIEnvironment);
             // the python harness sets this in the environment for us
             let profd = env.get("XPCSHELL_TEST_PROFILE_DIR");
             let dir = Components.classes["@mozilla.org/file/local;1"]
               .createInstance(Components.interfaces.nsILocalFile);
             dir.initWithPath(profd);
             let lock = CrashTestUtils.lockDir(dir);
             // when we crash, the lock file should be cleaned up
           },
           function(mdump, extra) {
             // if we got here, we have a minidump, so that's all we wanted
             do_check_true(true);
           });
}