michael@0: // enable crash reporting first michael@0: let cwd = Components.classes["@mozilla.org/file/directory_service;1"] michael@0: .getService(Components.interfaces.nsIProperties) michael@0: .get("CurWorkD", Components.interfaces.nsILocalFile); michael@0: michael@0: // get the temp dir michael@0: let env = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment); michael@0: let _tmpd = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); michael@0: _tmpd.initWithPath(env.get("XPCSHELL_TEST_TEMP_DIR")); michael@0: michael@0: let crashReporter = michael@0: Components.classes["@mozilla.org/toolkit/crash-reporter;1"] michael@0: .getService(Components.interfaces.nsICrashReporter); michael@0: michael@0: // We need to call this or crash events go in an undefined location. michael@0: crashReporter.UpdateCrashEventsDir(); michael@0: michael@0: // Setting the minidump path is not allowed in content processes michael@0: let processType = Components.classes["@mozilla.org/xre/runtime;1"]. michael@0: getService(Components.interfaces.nsIXULRuntime).processType; michael@0: if (processType == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT) { michael@0: crashReporter.minidumpPath = _tmpd; michael@0: } michael@0: michael@0: let ios = Components.classes["@mozilla.org/network/io-service;1"] michael@0: .getService(Components.interfaces.nsIIOService); michael@0: let protocolHandler = ios.getProtocolHandler("resource") michael@0: .QueryInterface(Components.interfaces.nsIResProtocolHandler); michael@0: let curDirURI = ios.newFileURI(cwd); michael@0: protocolHandler.setSubstitution("test", curDirURI); michael@0: Components.utils.import("resource://test/CrashTestUtils.jsm"); michael@0: let crashType = CrashTestUtils.CRASH_INVALID_POINTER_DEREF;