Bug 1186993 - Add MOZ_CHAOSMODE to XPCShell. r=roc

This commit is contained in:
J. Ryan Stinnett 2015-07-23 13:19:17 -05:00
Родитель 36bcd145f3
Коммит 87a2341396
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -8,6 +8,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "jsprf.h"
#include "mozilla/ChaosMode.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
@ -1258,6 +1259,20 @@ XRE_XPCShellMain(int argc, char** argv, char** envp)
UniquePtr<base::StatisticsRecorder> telStats =
MakeUnique<base::StatisticsRecorder>();
if (PR_GetEnv("MOZ_CHAOSMODE")) {
ChaosFeature feature = ChaosFeature::Any;
long featureInt = strtol(PR_GetEnv("MOZ_CHAOSMODE"), nullptr, 16);
if (featureInt) {
// NOTE: MOZ_CHAOSMODE=0 or a non-hex value maps to Any feature.
feature = static_cast<ChaosFeature>(featureInt);
}
ChaosMode::SetChaosFeature(feature);
}
if (ChaosMode::isActive(ChaosFeature::Any)) {
printf_stderr("*** You are running in chaos test mode. See ChaosMode.h. ***\n");
}
nsCOMPtr<nsIFile> appFile;
rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appFile));
if (NS_FAILED(rv)) {