Backed out 4 changesets (bug 1318004) for xpcshell failures a=backout CLOSED TREE

Backed out changeset a3fe53641526 (bug 1318004)
Backed out changeset a5d1676b6f88 (bug 1318004)
Backed out changeset b56b37f0f4d7 (bug 1318004)
Backed out changeset fb5254baf1cb (bug 1318004)
This commit is contained in:
Wes Kocher 2016-11-21 16:15:38 -08:00
Родитель 733e06d21b
Коммит 9cd626a6a3
25 изменённых файлов: 152 добавлений и 111 удалений

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

@ -55,7 +55,7 @@ public:
nsCommandLine();
protected:
~nsCommandLine() = default;
~nsCommandLine() { }
typedef nsresult (*EnumerateHandlersCallback)(nsICommandLineHandler* aHandler,
nsICommandLine* aThis,

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

@ -50,9 +50,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(Module)
NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable)
Module::Module() = default;
Module::Module()
{
}
Module::~Module() = default;
Module::~Module()
{
}
#define XPC_MAP_CLASSNAME Module
#define XPC_MAP_QUOTED_CLASSNAME "Module"

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

@ -47,7 +47,7 @@ public:
nsString mSearchString;
uint16_t mSearchResult;
private:
~nsFileResult() = default;
~nsFileResult() {}
};
NS_IMPL_ISUPPORTS(nsFileResult, nsIAutoCompleteResult)
@ -179,7 +179,7 @@ NS_IMETHODIMP nsFileResult::RemoveValueAt(int32_t rowIndex, bool removeFromDb)
class nsFileComplete final : public nsIAutoCompleteSearch
{
~nsFileComplete() = default;
~nsFileComplete() {}
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIAUTOCOMPLETESEARCH

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

@ -22,7 +22,9 @@ nsFindService::nsFindService()
}
nsFindService::~nsFindService() = default;
nsFindService::~nsFindService()
{
}
NS_IMPL_ISUPPORTS(nsFindService, nsIFindService)

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

@ -14,9 +14,13 @@ using namespace mozilla;
NS_IMPL_ISUPPORTS(MozIntl, mozIMozIntl)
MozIntl::MozIntl() = default;
MozIntl::MozIntl()
{
}
MozIntl::~MozIntl() = default;
MozIntl::~MozIntl()
{
}
NS_IMETHODIMP
MozIntl::AddGetCalendarInfo(JS::Handle<JS::Value> val, JSContext* cx)

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

@ -741,7 +741,7 @@ public:
, mResult(new TypedArrayResult(TimeStamp::Now()))
{ }
~DoReadToTypedArrayEvent() override {
~DoReadToTypedArrayEvent() {
// If AbstractReadEvent::Run() has bailed out, we may need to cleanup
// mResult, which is main-thread only data
if (!mResult) {
@ -778,7 +778,7 @@ public:
, mResult(new StringResult(TimeStamp::Now()))
{ }
~DoReadToStringEvent() override {
~DoReadToStringEvent() {
// If AbstraactReadEvent::Run() has bailed out, we may need to cleanup
// mResult, which is main-thread only data
if (!mResult) {

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

@ -16,7 +16,9 @@ nsParentalControlsService::nsParentalControlsService() :
mozilla::Unused << mEnabled;
}
nsParentalControlsService::~nsParentalControlsService() = default;
nsParentalControlsService::~nsParentalControlsService()
{
}
NS_IMETHODIMP
nsParentalControlsService::GetParentalControlsEnabled(bool *aResult)

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

@ -25,9 +25,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(Module)
NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable)
Module::Module() = default;
Module::Module()
{
}
Module::~Module() = default;
Module::~Module()
{
}
#define XPC_MAP_CLASSNAME Module
#define XPC_MAP_QUOTED_CLASSNAME "Module"

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

@ -51,7 +51,7 @@ new_test_uri()
class VisitURIObserver final : public nsIObserver
{
~VisitURIObserver() = default;
~VisitURIObserver() {}
public:
NS_DECL_ISUPPORTS
@ -309,7 +309,7 @@ namespace test_observer_topic_dispatched_helpers {
#define URI_VISITED_RESOLUTION_TOPIC "visited-status-resolution"
class statusObserver final : public nsIObserver
{
~statusObserver() = default;
~statusObserver() {}
public:
NS_DECL_ISUPPORTS

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

@ -23,9 +23,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(Module)
NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable)
Module::Module() = default;
Module::Module()
{
}
Module::~Module() = default;
Module::~Module()
{
}
#define XPC_MAP_CLASSNAME Module
#define XPC_MAP_QUOTED_CLASSNAME "Module"

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

@ -110,7 +110,9 @@ FindExtensionParameterInCommand(const char* aParameterName,
}
nsXRemoteService::nsXRemoteService() = default;
nsXRemoteService::nsXRemoteService()
{
}
void
nsXRemoteService::XRemoteBaseStartup(const char *aAppName, const char *aProfileName)

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

@ -179,7 +179,9 @@ CombinedStacks::SizeOfExcludingThis() const {
size_t n = 0;
n += mModules.capacity() * sizeof(Telemetry::ProcessedStack::Module);
n += mStacks.capacity() * sizeof(Stack);
for (const auto & s : mStacks) {
for (std::vector<Stack>::const_iterator i = mStacks.begin(),
e = mStacks.end(); i != e; ++i) {
const Stack& s = *i;
n += s.capacity() * sizeof(Telemetry::ProcessedStack::Frame);
}
return n;
@ -223,7 +225,7 @@ public:
: mHangIndices(aOther.mHangIndices)
, mAnnotations(Move(aOther.mAnnotations))
{}
~AnnotationInfo() = default;
~AnnotationInfo() {}
AnnotationInfo& operator=(AnnotationInfo&& aOther)
{
mHangIndices = aOther.mHangIndices;
@ -427,7 +429,7 @@ public:
* An implementation of Observe that records statistics of all
* file IO operations.
*/
void Observe(Observation& aOb) override;
void Observe(Observation& aOb);
/**
* Reflect recorded file IO statistics into Javascript
@ -1426,7 +1428,8 @@ IsValidBreakpadId(const std::string &breakpadId) {
if (breakpadId.size() < 33) {
return false;
}
for (char c : breakpadId) {
for (unsigned i = 0, n = breakpadId.size(); i < n; ++i) {
char c = breakpadId[i];
if ((c < '0' || c > '9') && (c < 'A' || c > 'F')) {
return false;
}
@ -1589,11 +1592,13 @@ CreateJSHangAnnotations(JSContext* cx, const HangAnnotationsVector& annotations,
// discard duplicated ones.
nsTHashtable<nsStringHashKey> reportedAnnotations;
size_t annotationIndex = 0;
for (const auto & curAnnotations : annotations) {
for (const HangAnnotationsPtr *i = annotations.begin(), *e = annotations.end();
i != e; ++i) {
JS::RootedObject jsAnnotation(cx, JS_NewPlainObject(cx));
if (!jsAnnotation) {
continue;
}
const HangAnnotationsPtr& curAnnotations = *i;
// Build a key to index the current annotations in our hash set.
nsAutoString annotationsKey;
nsresult rv = ComputeAnnotationsKey(curAnnotations, annotationsKey);
@ -1728,9 +1733,9 @@ TelemetryImpl::GetThreadHangStats(JSContext* cx, JS::MutableHandle<JS::Value> re
// Add saved threads next
MutexAutoLock autoLock(mThreadHangStatsMutex);
for (auto & stat : mThreadHangStats) {
for (size_t i = 0; i < mThreadHangStats.length(); i++) {
JS::RootedObject obj(cx,
CreateJSThreadHangStats(cx, stat));
CreateJSThreadHangStats(cx, mThreadHangStats[i]));
if (!JS_DefineElement(cx, retObj, threadIndex++, obj, JSPROP_ENUMERATE)) {
return NS_ERROR_FAILURE;
}
@ -2566,7 +2571,9 @@ RecordShutdownEndTimeStamp() {
namespace mozilla {
namespace Telemetry {
ProcessedStack::ProcessedStack() = default;
ProcessedStack::ProcessedStack()
{
}
size_t ProcessedStack::GetStackSize() const
{
@ -2678,7 +2685,9 @@ GetStackAndModules(const std::vector<uintptr_t>& aPCs)
// Copy the information to the return value.
ProcessedStack Ret;
for (auto & rawFrame : rawStack) {
for (std::vector<StackFrame>::iterator i = rawStack.begin(),
e = rawStack.end(); i != e; ++i) {
const StackFrame &rawFrame = *i;
mozilla::Telemetry::ProcessedStack::Frame frame = { rawFrame.mPC, rawFrame.mModIndex };
Ret.AddFrame(frame);
}
@ -2748,10 +2757,10 @@ HangStack::AppendViaBuffer(const char* aText, size_t aLength)
if (prevStart != mBuffer.begin()) {
// The buffer has moved; we have to adjust pointers in the stack.
for (auto & entry : *this) {
if (entry >= prevStart && entry < prevEnd) {
for (const char** entry = this->begin(); entry != this->end(); entry++) {
if (*entry >= prevStart && *entry < prevEnd) {
// Move from old buffer to new buffer.
entry += mBuffer.begin() - prevStart;
*entry += mBuffer.begin() - prevStart;
}
}
}

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

@ -281,7 +281,8 @@ internal_GetRegisteredHistogramIds(bool keyed, uint32_t dataset,
{
nsTArray<char*> collection;
for (const auto & h : gHistograms) {
for (size_t i = 0; i < mozilla::ArrayLength(gHistograms); ++i) {
const HistogramInfo& h = gHistograms[i];
if (IsExpiredVersion(h.expiration()) ||
h.keyed != keyed ||
!IsInDataset(h.dataset, dataset)) {
@ -750,7 +751,9 @@ void internal_Accumulate(mozilla::Telemetry::ID aHistogram, uint32_t aSample);
void
internal_IdentifyCorruptHistograms(StatisticsRecorder::Histograms &hs)
{
for (auto h : hs) {
for (HistogramIterator it = hs.begin(); it != hs.end(); ++it) {
Histogram *h = *it;
mozilla::Telemetry::ID id;
nsresult rv = internal_GetHistogramEnumId(h->histogram_name().c_str(), &id);
// This histogram isn't a static histogram, just ignore it.
@ -2061,7 +2064,8 @@ void TelemetryHistogram::InitializeGlobalState(bool canRecordBase,
mozilla::PodArrayZero(gCorruptHistograms);
// Create registered keyed histograms
for (const auto & h : gHistograms) {
for (size_t i = 0; i < mozilla::ArrayLength(gHistograms); ++i) {
const HistogramInfo& h = gHistograms[i];
if (!h.keyed) {
continue;
}
@ -2161,8 +2165,9 @@ void
TelemetryHistogram::InitHistogramRecordingEnabled()
{
StaticMutexAutoLock locker(gTelemetryHistogramMutex);
for (auto recordingInitiallyDisabledID : kRecordingInitiallyDisabledIDs) {
internal_SetHistogramRecordingEnabled(recordingInitiallyDisabledID,
const size_t length = mozilla::ArrayLength(kRecordingInitiallyDisabledIDs);
for (size_t i = 0; i < length; i++) {
internal_SetHistogramRecordingEnabled(kRecordingInitiallyDisabledIDs[i],
false);
}
}
@ -2397,7 +2402,8 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
// OK, now we can actually reflect things.
JS::Rooted<JSObject*> hobj(cx);
for (auto h : hs) {
for (HistogramIterator it = hs.begin(); it != hs.end(); ++it) {
Histogram *h = *it;
if (!internal_ShouldReflectHistogram(h) || internal_IsEmpty(h) ||
internal_IsExpired(h)) {
continue;
@ -2637,7 +2643,8 @@ TelemetryHistogram::GetHistogramSizesofIncludingThis(mozilla::MallocSizeOf
StatisticsRecorder::Histograms hs;
StatisticsRecorder::GetHistograms(&hs);
size_t n = 0;
for (auto h : hs) {
for (HistogramIterator it = hs.begin(); it != hs.end(); ++it) {
Histogram *h = *it;
n += h->SizeOfIncludingThis(aMallocSizeOf);
}
return n;

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

@ -154,7 +154,7 @@ ScalarInfo::expiration() const
class ScalarBase
{
public:
virtual ~ScalarBase() = default;
virtual ~ScalarBase() {};
// Set, Add and SetMaximum functions as described in the Telemetry IDL.
virtual ScalarResult SetValue(nsIVariant* aValue) = 0;
@ -194,7 +194,7 @@ public:
using ScalarBase::SetValue;
ScalarUnsigned() : mStorage(0) {};
~ScalarUnsigned() override = default;
~ScalarUnsigned() {};
ScalarResult SetValue(nsIVariant* aValue) final;
void SetValue(uint32_t aValue) final;
@ -334,7 +334,7 @@ public:
using ScalarBase::SetValue;
ScalarString() : mStorage(EmptyString()) {};
~ScalarString() override = default;
~ScalarString() {};
ScalarResult SetValue(nsIVariant* aValue) final;
ScalarResult SetValue(const nsAString& aValue) final;
@ -415,7 +415,7 @@ public:
using ScalarBase::SetValue;
ScalarBoolean() : mStorage(false) {};
~ScalarBoolean() override = default;
~ScalarBoolean() {};
ScalarResult SetValue(nsIVariant* aValue) final;
void SetValue(bool aValue) final;
@ -514,7 +514,7 @@ public:
typedef mozilla::Pair<nsCString, nsCOMPtr<nsIVariant>> KeyValuePair;
explicit KeyedScalar(uint32_t aScalarKind) : mScalarKind(aScalarKind) {};
~KeyedScalar() = default;
~KeyedScalar() {};
// Set, Add and SetMaximum functions as described in the Telemetry IDL.
// These methods implicitly instantiate a Scalar[*] for each key.

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

@ -173,9 +173,10 @@ RunWatchdog(void* arg)
class PR_CloseDelete
{
public:
constexpr PR_CloseDelete() = default;
constexpr PR_CloseDelete() {}
PR_CloseDelete(const PR_CloseDelete& aOther) = default;
PR_CloseDelete(const PR_CloseDelete& aOther)
{}
void operator()(PRFileDesc* aPtr) const
{
@ -341,8 +342,8 @@ nsTerminator::SelfInit()
return NS_ERROR_UNEXPECTED;
}
for (auto & shutdownStep : sShutdownSteps) {
DebugOnly<nsresult> rv = os->AddObserver(this, shutdownStep.mTopic, false);
for (size_t i = 0; i < ArrayLength(sShutdownSteps); ++i) {
DebugOnly<nsresult> rv = os->AddObserver(this, sShutdownSteps[i].mTopic, false);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "AddObserver failed");
}
@ -506,18 +507,18 @@ nsTerminator::UpdateTelemetry()
UniquePtr<nsCString> telemetryData(new nsCString());
telemetryData->AppendLiteral("{");
size_t fields = 0;
for (auto & shutdownStep : sShutdownSteps) {
if (shutdownStep.mTicks < 0) {
for (size_t i = 0; i < ArrayLength(sShutdownSteps); ++i) {
if (sShutdownSteps[i].mTicks < 0) {
// Ignore this field.
continue;
}
if (fields++ > 0) {
telemetryData->Append(", ");
}
telemetryData->AppendInt(shutdownStep.mTicks);
telemetryData->AppendLiteral(R"(")");
telemetryData->Append(shutdownStep.mTopic);
telemetryData->AppendLiteral(R"(": )");
telemetryData->AppendLiteral("\"");
telemetryData->Append(sShutdownSteps[i].mTopic);
telemetryData->AppendLiteral("\": ");
telemetryData->AppendInt(sShutdownSteps[i].mTicks);
}
telemetryData->AppendLiteral("}");

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

@ -224,7 +224,8 @@ HashStore::HashStore(const nsACString& aTableName,
}
HashStore::~HashStore()
= default;
{
}
nsresult
HashStore::Reset()

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

@ -56,7 +56,7 @@ public:
KeyPair(SECKEYPrivateKey* aPrivateKey, SECKEYPublicKey* aPublicKey);
private:
~KeyPair() override
~KeyPair()
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
@ -96,7 +96,7 @@ public:
KeyGenRunnable(KeyType keyType, nsIIdentityKeyGenCallback * aCallback);
private:
~KeyGenRunnable() override
~KeyGenRunnable()
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
@ -106,7 +106,7 @@ private:
shutdown(ShutdownCalledFrom::Object);
}
void virtualDestroyNSSReference() override
virtual void virtualDestroyNSSReference() override
{
destructorSafeDestroyNSSReference();
}
@ -133,7 +133,7 @@ public:
nsIIdentitySignCallback * aCallback);
private:
~SignRunnable() override
~SignRunnable()
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
@ -171,7 +171,7 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIIDENTITYCRYPTOSERVICE
IdentityCryptoService() = default;
IdentityCryptoService() { }
nsresult Init()
{
nsresult rv;
@ -183,7 +183,7 @@ public:
}
private:
~IdentityCryptoService() = default;
~IdentityCryptoService() { }
IdentityCryptoService(const KeyPair &) = delete;
void operator=(const IdentityCryptoService &) = delete;
};

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

@ -1086,7 +1086,7 @@ class Action
{
public:
Action() : mProgressCost(1), mNext(nullptr) { }
virtual ~Action() = default;
virtual ~Action() { }
virtual int Parse(NS_tchar *line) = 0;
@ -1115,10 +1115,10 @@ class RemoveFile : public Action
public:
RemoveFile() : mSkip(0) { }
int Parse(NS_tchar *line) override;
int Prepare() override;
int Execute() override;
void Finish(int status) override;
int Parse(NS_tchar *line);
int Prepare();
int Execute();
void Finish(int status);
private:
mozilla::UniquePtr<NS_tchar[]> mFile;
@ -1246,10 +1246,10 @@ class RemoveDir : public Action
public:
RemoveDir() : mSkip(0) { }
int Parse(NS_tchar *line) override;
int Prepare() override; // check that the source dir exists
int Execute() override;
void Finish(int status) override;
virtual int Parse(NS_tchar *line);
virtual int Prepare(); // check that the source dir exists
virtual int Execute();
virtual void Finish(int status);
private:
mozilla::UniquePtr<NS_tchar[]> mDir;
@ -1363,10 +1363,10 @@ class AddFile : public Action
public:
AddFile() : mAdded(false) { }
int Parse(NS_tchar *line) override;
int Prepare() override;
int Execute() override;
void Finish(int status) override;
virtual int Parse(NS_tchar *line);
virtual int Prepare();
virtual int Execute();
virtual void Finish(int status);
private:
mozilla::UniquePtr<NS_tchar[]> mFile;
@ -1466,12 +1466,12 @@ class PatchFile : public Action
public:
PatchFile() : mPatchFile(nullptr), mPatchIndex(-1), buf(nullptr) { }
~PatchFile() override;
virtual ~PatchFile();
int Parse(NS_tchar *line) override;
int Prepare() override; // should check for patch file and for checksum here
int Execute() override;
void Finish(int status) override;
virtual int Parse(NS_tchar *line);
virtual int Prepare(); // should check for patch file and for checksum here
virtual int Execute();
virtual void Finish(int status);
private:
int LoadSourceFile(FILE* ofile);
@ -1787,10 +1787,10 @@ PatchFile::Finish(int status)
class AddIfFile : public AddFile
{
public:
int Parse(NS_tchar *line) override;
int Prepare() override;
int Execute() override;
void Finish(int status) override;
virtual int Parse(NS_tchar *line);
virtual int Prepare();
virtual int Execute();
virtual void Finish(int status);
protected:
mozilla::UniquePtr<NS_tchar[]> mTestFile;
@ -1848,10 +1848,10 @@ AddIfFile::Finish(int status)
class AddIfNotFile : public AddFile
{
public:
int Parse(NS_tchar *line) override;
int Prepare() override;
int Execute() override;
void Finish(int status) override;
virtual int Parse(NS_tchar *line);
virtual int Prepare();
virtual int Execute();
virtual void Finish(int status);
protected:
mozilla::UniquePtr<NS_tchar[]> mTestFile;
@ -1909,10 +1909,10 @@ AddIfNotFile::Finish(int status)
class PatchIfFile : public PatchFile
{
public:
int Parse(NS_tchar *line) override;
int Prepare() override; // should check for patch file and for checksum here
int Execute() override;
void Finish(int status) override;
virtual int Parse(NS_tchar *line);
virtual int Prepare(); // should check for patch file and for checksum here
virtual int Execute();
virtual void Finish(int status);
private:
mozilla::UniquePtr<NS_tchar[]> mTestFile;

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

@ -82,10 +82,10 @@ nsGConfService::Init()
return NS_ERROR_FAILURE;
}
for (auto GConfSymbol : kGConfSymbols) {
*GConfSymbol.function =
PR_FindFunctionSymbol(gconfLib, GConfSymbol.functionName);
if (!*GConfSymbol.function) {
for (uint32_t i = 0; i < ArrayLength(kGConfSymbols); i++) {
*kGConfSymbols[i].function =
PR_FindFunctionSymbol(gconfLib, kGConfSymbols[i].functionName);
if (!*kGConfSymbols[i].function) {
return NS_ERROR_FAILURE;
}
}

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

@ -86,7 +86,7 @@ nsGIOMimeApp::Launch(const nsACString& aUri)
class GIOUTF8StringEnumerator final : public nsIUTF8StringEnumerator
{
~GIOUTF8StringEnumerator() = default;
~GIOUTF8StringEnumerator() { }
public:
GIOUTF8StringEnumerator() : mIndex(0) { }

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

@ -308,10 +308,10 @@ nsGSettingsService::Init()
return NS_ERROR_FAILURE;
}
for (auto GSettingsSymbol : kGSettingsSymbols) {
*GSettingsSymbol.function =
PR_FindFunctionSymbol(gioLib, GSettingsSymbol.functionName);
if (!*GSettingsSymbol.function) {
for (uint32_t i = 0; i < ArrayLength(kGSettingsSymbols); i++) {
*kGSettingsSymbols[i].function =
PR_FindFunctionSymbol(gioLib, kGSettingsSymbols[i].functionName);
if (!*kGSettingsSymbols[i].function) {
return NS_ERROR_FAILURE;
}
}

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

@ -93,10 +93,10 @@ nsPackageKitService::Init()
return NS_ERROR_FAILURE;
}
for (auto GDBusSymbol : kGDBusSymbols) {
*GDBusSymbol.function =
PR_FindFunctionSymbol(gioLib, GDBusSymbol.functionName);
if (!*GDBusSymbol.function) {
for (uint32_t i = 0; i < ArrayLength(kGDBusSymbols); i++) {
*kGDBusSymbols[i].function =
PR_FindFunctionSymbol(gioLib, kGDBusSymbols[i].functionName);
if (!*kGDBusSymbols[i].function) {
return NS_ERROR_FAILURE;
}
}

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

@ -18,10 +18,11 @@ NS_INTERFACE_MAP_BEGIN(nsSystemAlertsService)
NS_INTERFACE_MAP_END_THREADSAFE
nsSystemAlertsService::nsSystemAlertsService()
= default;
{
}
nsSystemAlertsService::~nsSystemAlertsService()
= default;
{}
nsresult
nsSystemAlertsService::Init()

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

@ -33,7 +33,7 @@ public:
nsresult Init();
private:
~nsUnixSystemProxySettings() = default;
~nsUnixSystemProxySettings() {}
nsCOMPtr<nsIGConfService> mGConf;
nsCOMPtr<nsIGSettingsService> mGSettings;

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

@ -2748,18 +2748,18 @@ static struct SavedVar {
static void SaveStateForAppInitiatedRestart()
{
for (auto & savedVar : gSavedVars) {
const char *s = PR_GetEnv(savedVar.name);
for (size_t i = 0; i < ArrayLength(gSavedVars); ++i) {
const char *s = PR_GetEnv(gSavedVars[i].name);
if (s)
savedVar.value = PR_smprintf("%s=%s", savedVar.name, s);
gSavedVars[i].value = PR_smprintf("%s=%s", gSavedVars[i].name, s);
}
}
static void RestoreStateForAppInitiatedRestart()
{
for (auto & savedVar : gSavedVars) {
if (savedVar.value)
PR_SetEnv(savedVar.value);
for (size_t i = 0; i < ArrayLength(gSavedVars); ++i) {
if (gSavedVars[i].value)
PR_SetEnv(gSavedVars[i].value);
}
}