Backed out 4 changesets (bug 1318004) for xpcshell failures a=backout CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Mon, 21 Nov 2016 16:15:38 -0800
changeset 323674 c22454e450c6415280d30ceae8ed3d566ca7dd67
parent 323673 9f88b41193c6bf9730f75170ecb4cdb932450738
child 323675 42c3a09033f081dcd4105567d735331df3e3f779
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersbackout
bugs1318004
milestone53.0a1
backs outa3fe53641526ae8017b36182cbdb8dfbc81debff
a5d1676b6f88b59437df3ce354557d66755bbcb0
b56b37f0f4d7e1a89cde7199d04ea55fde021bb0
fb5254baf1cbde205307d6e010f5e6dcc0ad0ade
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)
toolkit/components/commandlines/nsCommandLine.cpp
toolkit/components/ctypes/ctypes.cpp
toolkit/components/filepicker/nsFileView.cpp
toolkit/components/find/nsFindService.cpp
toolkit/components/mozintl/MozIntl.cpp
toolkit/components/osfile/NativeOSFileInternals.cpp
toolkit/components/parentalcontrols/nsParentalControlsServiceDefault.cpp
toolkit/components/perf/PerfMeasurement.cpp
toolkit/components/places/tests/gtest/test_IHistory.cpp
toolkit/components/reflect/reflect.cpp
toolkit/components/remote/nsXRemoteService.cpp
toolkit/components/telemetry/Telemetry.cpp
toolkit/components/telemetry/TelemetryHistogram.cpp
toolkit/components/telemetry/TelemetryScalar.cpp
toolkit/components/terminator/nsTerminator.cpp
toolkit/components/url-classifier/HashStore.cpp
toolkit/identity/IdentityCryptoService.cpp
toolkit/mozapps/update/updater/updater.cpp
toolkit/system/gnome/nsGConfService.cpp
toolkit/system/gnome/nsGIOService.cpp
toolkit/system/gnome/nsGSettingsService.cpp
toolkit/system/gnome/nsPackageKitService.cpp
toolkit/system/gnome/nsSystemAlertsService.cpp
toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/components/commandlines/nsCommandLine.cpp
+++ b/toolkit/components/commandlines/nsCommandLine.cpp
@@ -50,17 +50,17 @@ class nsCommandLine final : public nsICo
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICOMMANDLINE
   NS_DECL_NSICOMMANDLINERUNNER
 
   nsCommandLine();
 
 protected:
-  ~nsCommandLine() = default;
+  ~nsCommandLine() { }
 
   typedef nsresult (*EnumerateHandlersCallback)(nsICommandLineHandler* aHandler,
 					nsICommandLine* aThis,
 					void *aClosure);
   typedef nsresult (*EnumerateValidatorsCallback)(nsICommandLineValidator* aValidator,
 					nsICommandLine* aThis,
 					void *aClosure);
 
--- a/toolkit/components/ctypes/ctypes.cpp
+++ b/toolkit/components/ctypes/ctypes.cpp
@@ -45,19 +45,23 @@ UnicodeToNative(JSContext *cx, const cha
 static JSCTypesCallbacks sCallbacks = {
   UnicodeToNative
 };
 
 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"
 #define XPC_MAP_WANT_CALL
 #define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
 #include "xpc_map_end.h"
 
 static bool
--- a/toolkit/components/filepicker/nsFileView.cpp
+++ b/toolkit/components/filepicker/nsFileView.cpp
@@ -42,17 +42,17 @@ public:
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIAUTOCOMPLETERESULT
 
   nsTArray<nsString> mValues;
   nsString mSearchString;
   uint16_t mSearchResult;
 private:
-  ~nsFileResult() = default;
+  ~nsFileResult() {}
 };
 
 NS_IMPL_ISUPPORTS(nsFileResult, nsIAutoCompleteResult)
 
 nsFileResult::nsFileResult(const nsAString& aSearchString,
                            const nsAString& aSearchParam):
   mSearchString(aSearchString)
 {
@@ -174,17 +174,17 @@ NS_IMETHODIMP nsFileResult::GetFinalComp
 
 NS_IMETHODIMP nsFileResult::RemoveValueAt(int32_t rowIndex, bool removeFromDb)
 {
   return NS_OK;
 }
 
 class nsFileComplete final : public nsIAutoCompleteSearch
 {
-  ~nsFileComplete() = default;
+  ~nsFileComplete() {}
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIAUTOCOMPLETESEARCH
 };
 
 NS_IMPL_ISUPPORTS(nsFileComplete, nsIAutoCompleteSearch)
 
 NS_IMETHODIMP
--- a/toolkit/components/find/nsFindService.cpp
+++ b/toolkit/components/find/nsFindService.cpp
@@ -17,17 +17,19 @@ nsFindService::nsFindService()
 : mFindBackwards(false)
 , mWrapFind(true)
 , mEntireWord(false)
 , mMatchCase(false)
 {
 }
 
 
-nsFindService::~nsFindService() = default;
+nsFindService::~nsFindService()
+{
+}
 
 NS_IMPL_ISUPPORTS(nsFindService, nsIFindService)
 
 NS_IMETHODIMP nsFindService::GetSearchString(nsAString & aSearchString)
 {
     aSearchString = mSearchString;
     return NS_OK;
 }
--- a/toolkit/components/mozintl/MozIntl.cpp
+++ b/toolkit/components/mozintl/MozIntl.cpp
@@ -9,19 +9,23 @@
 
 #define MOZ_MOZINTL_CID \
   { 0x83f8f991, 0x6b81, 0x4dd8, { 0xa0, 0x93, 0x72, 0x0b, 0xfb, 0x67, 0x4d, 0x38 } }
 
 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)
 {
   if (!val.isObject()) {
     return NS_ERROR_INVALID_ARG;
   }
 
--- a/toolkit/components/osfile/NativeOSFileInternals.cpp
+++ b/toolkit/components/osfile/NativeOSFileInternals.cpp
@@ -736,17 +736,17 @@ public:
                           const uint32_t aBytes,
                           nsMainThreadPtrHandle<nsINativeOSFileSuccessCallback>& aOnSuccess,
                           nsMainThreadPtrHandle<nsINativeOSFileErrorCallback>& aOnError)
     : AbstractReadEvent(aPath, aBytes,
                         aOnSuccess, aOnError)
     , 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) {
       return;
     }
     NS_ReleaseOnMainThread(mResult.forget());
   }
 
@@ -773,17 +773,17 @@ public:
                       const uint32_t aBytes,
                       nsMainThreadPtrHandle<nsINativeOSFileSuccessCallback>& aOnSuccess,
                       nsMainThreadPtrHandle<nsINativeOSFileErrorCallback>& aOnError)
     : AbstractReadEvent(aPath, aBytes, aOnSuccess, aOnError)
     , mEncoding(aEncoding)
     , 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) {
       return;
     }
     NS_ReleaseOnMainThread(mResult.forget());
   }
 
--- a/toolkit/components/parentalcontrols/nsParentalControlsServiceDefault.cpp
+++ b/toolkit/components/parentalcontrols/nsParentalControlsServiceDefault.cpp
@@ -11,17 +11,19 @@
 NS_IMPL_ISUPPORTS(nsParentalControlsService, nsIParentalControlsService)
 
 nsParentalControlsService::nsParentalControlsService() :
   mEnabled(false)
 {
   mozilla::Unused << mEnabled;
 }
 
-nsParentalControlsService::~nsParentalControlsService() = default;
+nsParentalControlsService::~nsParentalControlsService()
+{
+}
 
 NS_IMETHODIMP
 nsParentalControlsService::GetParentalControlsEnabled(bool *aResult)
 {
   *aResult = false;
   return NS_OK;
 }
 
--- a/toolkit/components/perf/PerfMeasurement.cpp
+++ b/toolkit/components/perf/PerfMeasurement.cpp
@@ -20,19 +20,23 @@
 
 namespace mozilla {
 namespace jsperf {
 
 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"
 #define XPC_MAP_WANT_CALL
 #define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
 #include "xpc_map_end.h"
 
 static bool
--- a/toolkit/components/places/tests/gtest/test_IHistory.cpp
+++ b/toolkit/components/places/tests/gtest/test_IHistory.cpp
@@ -46,17 +46,17 @@ new_test_uri()
   nsCOMPtr<nsIURI> testURI;
   nsresult rv = NS_NewURI(getter_AddRefs(testURI), spec);
   do_check_success(rv);
   return testURI.forget();
 }
 
 class VisitURIObserver final : public nsIObserver
 {
-  ~VisitURIObserver() = default;
+  ~VisitURIObserver() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   explicit VisitURIObserver(int aExpectedVisits = 1) :
     mVisits(0),
     mExpectedVisits(aExpectedVisits)
   {
@@ -304,17 +304,17 @@ test_RegisterVisitedCallback_returns_bef
 }
 
 namespace test_observer_topic_dispatched_helpers {
   #define URI_VISITED "visited"
   #define URI_NOT_VISITED "not visited"
   #define URI_VISITED_RESOLUTION_TOPIC "visited-status-resolution"
   class statusObserver final : public nsIObserver
   {
-    ~statusObserver() = default;
+    ~statusObserver() {}
 
   public:
     NS_DECL_ISUPPORTS
 
     statusObserver(nsIURI* aURI,
                    const bool aExpectVisit,
                    bool& _notified)
     : mURI(aURI)
--- a/toolkit/components/reflect/reflect.cpp
+++ b/toolkit/components/reflect/reflect.cpp
@@ -18,19 +18,23 @@
 
 namespace mozilla {
 namespace reflect {
 
 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"
 #define XPC_MAP_WANT_CALL
 #define XPC_MAP_FLAGS nsIXPCScriptable::WANT_CALL
 #include "xpc_map_end.h"
 
 NS_IMETHODIMP
--- a/toolkit/components/remote/nsXRemoteService.cpp
+++ b/toolkit/components/remote/nsXRemoteService.cpp
@@ -105,17 +105,19 @@ FindExtensionParameterInCommand(const ch
   } else {
     idEnd = charEnd;
   }
   *aValue = nsDependentCSubstring(idStart, idEnd);
   return true;
 }
 
 
-nsXRemoteService::nsXRemoteService() = default;
+nsXRemoteService::nsXRemoteService()
+{    
+}
 
 void
 nsXRemoteService::XRemoteBaseStartup(const char *aAppName, const char *aProfileName)
 {
     EnsureAtoms();
 
     mAppName = aAppName;
     ToLowerCase(mAppName);
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -174,17 +174,19 @@ CombinedStacks::SizeOfExcludingThis() co
   // aMallocSizeOf(&mModules[0]), but on linux aMallocSizeOf will call
   // malloc_usable_size which is only safe on the pointers returned by malloc.
   // While it works on current libstdc++, it is better to be safe and not assume
   // that &vec[0] points to one. We could use a custom allocator, but
   // it doesn't seem worth it.
   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;
 }
 
 // This utility function generates a string key that is used to index the annotations
 // in a hash map from |HangReports::AddHang|.
 nsresult
@@ -218,17 +220,17 @@ public:
       : mAnnotations(Move(aAnnotations))
     {
       mHangIndices.AppendElement(aHangIndex);
     }
     AnnotationInfo(AnnotationInfo&& aOther)
       : mHangIndices(aOther.mHangIndices)
       , mAnnotations(Move(aOther.mAnnotations))
     {}
-    ~AnnotationInfo() = default;
+    ~AnnotationInfo() {}
     AnnotationInfo& operator=(AnnotationInfo&& aOther)
     {
       mHangIndices = aOther.mHangIndices;
       mAnnotations = Move(aOther.mAnnotations);
       return *this;
     }
     // To save memory, a single AnnotationInfo can be associated to multiple chrome
     // hangs. The following array holds the index of each related chrome hang.
@@ -422,17 +424,17 @@ class TelemetryIOInterposeObserver : pub
 
 public:
   explicit TelemetryIOInterposeObserver(nsIFile* aXreDir);
 
   /**
    * 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
    */
   bool ReflectIntoJS(JSContext *cx, JS::Handle<JSObject*> rootObj);
 
   /**
    * Adds a path for inclusion in main thread I/O report.
@@ -1421,17 +1423,18 @@ CreateJSStackObject(JSContext *cx, const
   return ret;
 }
 
 static bool
 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;
     }
   }
   return true;
 }
 
 // Read a stack from the given file name. In case of any error, aStack is
@@ -1584,21 +1587,23 @@ CreateJSHangAnnotations(JSContext* cx, c
   if (!annotationsArray) {
     returnedObject.set(nullptr);
     return;
   }
   // We keep track of the annotations we reported in this hash set, so we can
   // 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);
     if (NS_FAILED(rv)) {
       continue;
     }
     // Check if the annotations are in the set. If that's the case, don't double report.
     if (reportedAnnotations.GetEntry(annotationsKey)) {
@@ -1723,19 +1728,19 @@ TelemetryImpl::GetThreadHangStats(JSCont
       if (!JS_DefineElement(cx, retObj, threadIndex++, obj, JSPROP_ENUMERATE)) {
         return NS_ERROR_FAILURE;
       }
     }
   }
 
   // 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;
     }
   }
   ret.setObject(*retObj);
   return NS_OK;
 }
 
@@ -2561,17 +2566,19 @@ RecordShutdownEndTimeStamp() {
 ////////////////////////////////////////////////////////////////////////
 //
 // EXTERNALLY VISIBLE FUNCTIONS in mozilla::Telemetry::
 // These are NOT listed in Telemetry.h
 
 namespace mozilla {
 namespace Telemetry {
 
-ProcessedStack::ProcessedStack() = default;
+ProcessedStack::ProcessedStack()
+{
+}
 
 size_t ProcessedStack::GetStackSize() const
 {
   return mStack.size();
 }
 
 size_t ProcessedStack::GetNumModules() const
 {
@@ -2673,17 +2680,19 @@ GetStackAndModules(const std::vector<uin
     rawStack[stackIndex].mPC = std::numeric_limits<uintptr_t>::max();
   }
 
   std::sort(rawStack.begin(), rawStack.end(), CompareByIndex);
 #endif
 
   // 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);
   }
 
 #ifdef MOZ_ENABLE_PROFILER_SPS
   for (unsigned i = 0, n = rawModules.GetSize(); i != n; ++i) {
     const SharedLibrary &info = rawModules.GetEntry(i);
     const std::string &name = info.GetName();
@@ -2743,20 +2752,20 @@ HangStack::AppendViaBuffer(const char* a
 
   // Include null-terminator in length count.
   if (!mBuffer.reserve(mBuffer.length() + aLength + 1)) {
     return nullptr;
   }
 
   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;
       }
     }
   }
 
   return InfallibleAppendViaBuffer(aText, aLength);
 }
 
 uint32_t
--- a/toolkit/components/telemetry/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/TelemetryHistogram.cpp
@@ -276,17 +276,18 @@ internal_IsExpired(const Histogram *hist
 }
 
 nsresult
 internal_GetRegisteredHistogramIds(bool keyed, uint32_t dataset,
                                    uint32_t *aCount, char*** aHistograms)
 {
   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)) {
       continue;
     }
 
     const char* id = h.id();
     const size_t len = strlen(id);
@@ -745,17 +746,19 @@ internal_HistogramClear(Histogram& aHist
 
 namespace {
 
 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.
     if (NS_FAILED(rv)) {
       continue;
     }
 
     if (gCorruptHistograms[id]) {
@@ -2056,17 +2059,18 @@ void TelemetryHistogram::InitializeGloba
 
 #ifdef DEBUG
   gHistogramMap.MarkImmutable();
 #endif
 
   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;
     }
 
     const nsDependentCString id(h.id());
     const nsDependentCString expiration(h.expiration());
     gKeyedHistograms.Put(id, new KeyedHistogram(id, expiration, h.histogramType,
                                                 h.min, h.max, h.bucketCount, h.dataset));
@@ -2156,18 +2160,19 @@ TelemetryHistogram::SetCanRecordExtended
   gCanRecordExtended = b;
 }
 
 
 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);
   }
 }
 
 void
 TelemetryHistogram::SetHistogramRecordingEnabled(mozilla::Telemetry::ID aID,
                                                  bool aEnabled)
 {
@@ -2392,17 +2397,18 @@ TelemetryHistogram::CreateHistogramSnaps
   // depend on histogram enumeration order.
   //
   // Of course, we hope that all of these corruption-statistics
   // histograms are not themselves corrupt...
   internal_IdentifyCorruptHistograms(hs);
 
   // 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;
     }
 
     Histogram* original = h;
 #if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
     if (subsession) {
@@ -2632,17 +2638,18 @@ TelemetryHistogram::GetMapShallowSizesOf
 size_t
 TelemetryHistogram::GetHistogramSizesofIncludingThis(mozilla::MallocSizeOf
                                                      aMallocSizeOf)
 {
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
   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;
 }
 
 // This method takes the lock only to double-buffer the batched telemetry.
 // It releases the lock before calling out to IPC code which can (and does)
 // Accumulate (which would deadlock)
--- a/toolkit/components/telemetry/TelemetryScalar.cpp
+++ b/toolkit/components/telemetry/TelemetryScalar.cpp
@@ -149,17 +149,17 @@ ScalarInfo::expiration() const
 
 /**
  * The base scalar object, that servers as a common ancestor for storage
  * purposes.
  */
 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;
   virtual ScalarResult AddValue(nsIVariant* aValue) { return ScalarResult::OperationNotSupported; }
   virtual ScalarResult SetMaximum(nsIVariant* aValue) { return ScalarResult::OperationNotSupported; }
 
   // Convenience methods used by the C++ API.
   virtual void SetValue(uint32_t aValue) { mozilla::Unused << HandleUnsupported(); }
@@ -189,17 +189,17 @@ ScalarBase::HandleUnsupported() const
  * The implementation for the unsigned int scalar type.
  */
 class ScalarUnsigned : public ScalarBase
 {
 public:
   using ScalarBase::SetValue;
 
   ScalarUnsigned() : mStorage(0) {};
-  ~ScalarUnsigned() override = default;
+  ~ScalarUnsigned() {};
 
   ScalarResult SetValue(nsIVariant* aValue) final;
   void SetValue(uint32_t aValue) final;
   ScalarResult AddValue(nsIVariant* aValue) final;
   void AddValue(uint32_t aValue) final;
   ScalarResult SetMaximum(nsIVariant* aValue) final;
   void SetMaximum(uint32_t aValue) final;
   nsresult GetValue(nsCOMPtr<nsIVariant>& aResult) const final;
@@ -329,17 +329,17 @@ ScalarUnsigned::CheckInput(nsIVariant* a
  * The implementation for the string scalar type.
  */
 class ScalarString : public ScalarBase
 {
 public:
   using ScalarBase::SetValue;
 
   ScalarString() : mStorage(EmptyString()) {};
-  ~ScalarString() override = default;
+  ~ScalarString() {};
 
   ScalarResult SetValue(nsIVariant* aValue) final;
   ScalarResult SetValue(const nsAString& aValue) final;
   nsresult GetValue(nsCOMPtr<nsIVariant>& aResult) const final;
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const final;
 
 private:
   nsString mStorage;
@@ -410,17 +410,17 @@ ScalarString::SizeOfIncludingThis(mozill
  * The implementation for the boolean scalar type.
  */
 class ScalarBoolean : public ScalarBase
 {
 public:
   using ScalarBase::SetValue;
 
   ScalarBoolean() : mStorage(false) {};
-  ~ScalarBoolean() override = default;
+  ~ScalarBoolean() {};
 
   ScalarResult SetValue(nsIVariant* aValue) final;
   void SetValue(bool aValue) final;
   nsresult GetValue(nsCOMPtr<nsIVariant>& aResult) const final;
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const final;
 
 private:
   bool mStorage;
@@ -509,17 +509,17 @@ internal_ScalarAllocate(uint32_t aScalar
  * The implementation for the keyed scalar type.
  */
 class KeyedScalar
 {
 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.
   ScalarResult SetValue(const nsAString& aKey, nsIVariant* aValue);
   ScalarResult AddValue(const nsAString& aKey, nsIVariant* aValue);
   ScalarResult SetMaximum(const nsAString& aKey, nsIVariant* aValue);
 
   // Convenience methods used by the C++ API.
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -168,19 +168,20 @@ RunWatchdog(void* arg)
 // thread rather than usual XPCOM I/O simply because we outlive XPCOM and its
 // threads.
 //
 
 // Utility class, used by UniquePtr<> to close nspr files.
 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
   {
     PR_Close(aPtr);
   }
 };
 
 //
@@ -336,18 +337,18 @@ nsTerminator::nsTerminator()
 nsresult
 nsTerminator::SelfInit()
 {
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (!os) {
     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");
   }
 
   return NS_OK;
 }
 
 // Actually launch these threads. This takes place at the first sign of shutdown.
 void
@@ -501,28 +502,28 @@ nsTerminator::UpdateTelemetry()
   // late to record such data into Telemetry, so we write it to disk
   // and read it upon the next startup.
   //
 
   // Build JSON.
   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("}");
 
   if (fields == 0) {
     // Nothing to write
       return;
   }
 
--- a/toolkit/components/url-classifier/HashStore.cpp
+++ b/toolkit/components/url-classifier/HashStore.cpp
@@ -219,17 +219,18 @@ HashStore::HashStore(const nsACString& a
                                                      getter_AddRefs(mStoreDirectory));
   if (NS_FAILED(rv)) {
     LOG(("Failed to get private store directory for %s", mTableName.get()));
     mStoreDirectory = aRootStoreDir;
   }
 }
 
 HashStore::~HashStore()
-= default;
+{
+}
 
 nsresult
 HashStore::Reset()
 {
   LOG(("HashStore resetting"));
 
   nsCOMPtr<nsIFile> storeFile;
   nsresult rv = mStoreDirectory->Clone(getter_AddRefs(storeFile));
--- a/toolkit/identity/IdentityCryptoService.cpp
+++ b/toolkit/identity/IdentityCryptoService.cpp
@@ -51,17 +51,17 @@ class KeyPair : public nsIIdentityKeyPai
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIDENTITYKEYPAIR
 
   KeyPair(SECKEYPrivateKey* aPrivateKey, SECKEYPublicKey* aPublicKey);
 
 private:
-  ~KeyPair() override
+  ~KeyPair()
   {
     nsNSSShutDownPreventionLock locker;
     if (isAlreadyShutDown()) {
       return;
     }
     destructorSafeDestroyNSSReference();
     shutdown(ShutdownCalledFrom::Object);
   }
@@ -91,27 +91,27 @@ NS_IMPL_ISUPPORTS(KeyPair, nsIIdentityKe
 class KeyGenRunnable : public Runnable, public nsNSSShutDownObject
 {
 public:
   NS_DECL_NSIRUNNABLE
 
   KeyGenRunnable(KeyType keyType, nsIIdentityKeyGenCallback * aCallback);
 
 private:
-  ~KeyGenRunnable() override
+  ~KeyGenRunnable()
   {
     nsNSSShutDownPreventionLock locker;
     if (isAlreadyShutDown()) {
       return;
     }
     destructorSafeDestroyNSSReference();
     shutdown(ShutdownCalledFrom::Object);
   }
 
-  void virtualDestroyNSSReference() override
+  virtual void virtualDestroyNSSReference() override
   {
     destructorSafeDestroyNSSReference();
   }
 
   void destructorSafeDestroyNSSReference()
   {
   }
 
@@ -128,17 +128,17 @@ class SignRunnable : public Runnable, pu
 {
 public:
   NS_DECL_NSIRUNNABLE
 
   SignRunnable(const nsACString & textToSign, SECKEYPrivateKey * privateKey,
                nsIIdentitySignCallback * aCallback);
 
 private:
-  ~SignRunnable() override
+  ~SignRunnable()
   {
     nsNSSShutDownPreventionLock locker;
     if (isAlreadyShutDown()) {
       return;
     }
     destructorSafeDestroyNSSReference();
     shutdown(ShutdownCalledFrom::Object);
   }
@@ -166,29 +166,29 @@ private:
 };
 
 class IdentityCryptoService final : public nsIIdentityCryptoService
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIDENTITYCRYPTOSERVICE
 
-  IdentityCryptoService() = default;
+  IdentityCryptoService() { }
   nsresult Init()
   {
     nsresult rv;
     nsCOMPtr<nsISupports> dummyUsedToEnsureNSSIsInitialized
       = do_GetService("@mozilla.org/psm;1", &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     return NS_OK;
   }
 
 private:
-  ~IdentityCryptoService() = default;
+  ~IdentityCryptoService() { }
   IdentityCryptoService(const KeyPair &) = delete;
   void operator=(const IdentityCryptoService &) = delete;
 };
 
 NS_IMPL_ISUPPORTS(IdentityCryptoService, nsIIdentityCryptoService)
 
 NS_IMETHODIMP
 IdentityCryptoService::GenerateKeyPair(
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -1081,17 +1081,17 @@ static void backup_finish(const NS_tchar
 //-----------------------------------------------------------------------------
 
 static int DoUpdate();
 
 class Action
 {
 public:
   Action() : mProgressCost(1), mNext(nullptr) { }
-  virtual ~Action() = default;
+  virtual ~Action() { }
 
   virtual int Parse(NS_tchar *line) = 0;
 
   // Do any preprocessing to ensure that the action can be performed.  Execute
   // will be called if this Action and all others return OK from this method.
   virtual int Prepare() = 0;
 
   // Perform the operation.  Return OK to indicate success.  After all actions
@@ -1110,20 +1110,20 @@ private:
   friend class ActionList;
 };
 
 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;
   mozilla::UniquePtr<NS_tchar[]> mRelPath;
   int mSkip;
 };
 
 int
@@ -1241,20 +1241,20 @@ RemoveFile::Finish(int status)
   }
 }
 
 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;
   mozilla::UniquePtr<NS_tchar[]> mRelPath;
   int mSkip;
 };
 
 int
@@ -1358,20 +1358,20 @@ RemoveDir::Finish(int status)
   }
 }
 
 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;
   mozilla::UniquePtr<NS_tchar[]> mRelPath;
   bool mAdded;
 };
 
 int
@@ -1461,22 +1461,22 @@ AddFile::Finish(int status)
   }
 }
 
 class PatchFile : public Action
 {
 public:
   PatchFile() : mPatchFile(nullptr), mPatchIndex(-1), buf(nullptr) { }
 
-  ~PatchFile() override;
-
-  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 ~PatchFile();
+
+  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);
 
   static int sPatchIndex;
 
   const NS_tchar *mPatchFile;
   mozilla::UniquePtr<NS_tchar[]> mFile;
@@ -1782,20 +1782,20 @@ PatchFile::Finish(int status)
   if (!sStagedUpdate) {
     backup_finish(mFile.get(), mFileRelPath.get(), 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;
 };
 
 int
 AddIfFile::Parse(NS_tchar *line)
 {
@@ -1843,20 +1843,20 @@ AddIfFile::Finish(int status)
     return;
 
   AddFile::Finish(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;
 };
 
 int
 AddIfNotFile::Parse(NS_tchar *line)
 {
@@ -1904,20 +1904,20 @@ AddIfNotFile::Finish(int status)
     return;
 
   AddFile::Finish(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;
 };
 
 int
 PatchIfFile::Parse(NS_tchar *line)
 {
--- a/toolkit/system/gnome/nsGConfService.cpp
+++ b/toolkit/system/gnome/nsGConfService.cpp
@@ -77,20 +77,20 @@ nsGConfService::Init()
 #undef FUNC
 
   if (!gconfLib) {
     gconfLib = PR_LoadLibrary("libgconf-2.so.4");
     if (!gconfLib)
       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;
     }
   }
 
   mClient = gconf_client_get_default();
   return mClient ? NS_OK : NS_ERROR_FAILURE;
 }
 
--- a/toolkit/system/gnome/nsGIOService.cpp
+++ b/toolkit/system/gnome/nsGIOService.cpp
@@ -81,17 +81,17 @@ nsGIOMimeApp::Launch(const nsACString& a
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 class GIOUTF8StringEnumerator final : public nsIUTF8StringEnumerator
 {
-  ~GIOUTF8StringEnumerator() = default;
+  ~GIOUTF8StringEnumerator() { }
 
 public:
   GIOUTF8StringEnumerator() : mIndex(0) { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUTF8STRINGENUMERATOR
 
   nsTArray<nsCString> mStrings;
--- a/toolkit/system/gnome/nsGSettingsService.cpp
+++ b/toolkit/system/gnome/nsGSettingsService.cpp
@@ -303,20 +303,20 @@ nsGSettingsService::Init()
 #undef FUNC
 
   if (!gioLib) {
     gioLib = PR_LoadLibrary("libgio-2.0.so.0");
     if (!gioLib)
       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;
     }
   }
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(nsGSettingsService, nsIGSettingsService)
--- a/toolkit/system/gnome/nsPackageKitService.cpp
+++ b/toolkit/system/gnome/nsPackageKitService.cpp
@@ -88,20 +88,20 @@ nsPackageKitService::Init()
 #undef FUNC
 
   if (!gioLib) {
     gioLib = PR_LoadLibrary("libgio-2.0.so.0");
     if (!gioLib)
       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;
     }
   }
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(nsPackageKitService, nsIPackageKitService)
--- a/toolkit/system/gnome/nsSystemAlertsService.cpp
+++ b/toolkit/system/gnome/nsSystemAlertsService.cpp
@@ -13,20 +13,21 @@ NS_IMPL_ADDREF(nsSystemAlertsService)
 NS_IMPL_RELEASE(nsSystemAlertsService)
 
 NS_INTERFACE_MAP_BEGIN(nsSystemAlertsService)
    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAlertsService)
    NS_INTERFACE_MAP_ENTRY(nsIAlertsService)
 NS_INTERFACE_MAP_END_THREADSAFE
 
 nsSystemAlertsService::nsSystemAlertsService()
-= default;
+{
+}
 
 nsSystemAlertsService::~nsSystemAlertsService()
-= default;
+{}
 
 nsresult
 nsSystemAlertsService::Init()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP nsSystemAlertsService::ShowAlertNotification(const nsAString & aImageUrl, const nsAString & aAlertTitle, 
--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
@@ -28,17 +28,17 @@ public:
 
   nsUnixSystemProxySettings()
     : mSchemeProxySettings(4)
   {
   }
   nsresult Init();
 
 private:
-  ~nsUnixSystemProxySettings() = default;
+  ~nsUnixSystemProxySettings() {}
   
   nsCOMPtr<nsIGConfService> mGConf;
   nsCOMPtr<nsIGSettingsService> mGSettings;
   nsCOMPtr<nsIGSettingsCollection> mProxySettings;
   nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
   bool IsProxyMode(const char* aMode);
   nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
   nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2743,28 +2743,28 @@ static struct SavedVar {
   const char *name;
   char *value;
 } gSavedVars[] = {
   {"XUL_APP_FILE", nullptr}
 };
 
 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);
   }
 }
 
 #ifdef MOZ_CRASHREPORTER
 // When we first initialize the crash reporter we don't have a profile,
 // so we set the minidump path to $TEMP.  Once we have a profile,
 // we set it to $PROFILE/minidumps, creating the directory
 // if needed.