Backed out changeset bee1c344cb47 (bug 1491909) for failures in browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
authorNoemi Erli <nerli@mozilla.com>
Wed, 24 Oct 2018 04:23:13 +0300
changeset 491044 3b8a9abe2766c4bdc68c143416a3aafe85083be4
parent 491043 8ff4dac9916d9bd908611963de3ec8883befea5f
child 491045 d0d1ccfded5ddefa99bb206ffac2235b457abffe
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
bugs1491909
milestone65.0a1
backs outbee1c344cb473d75347c012bbd0f8eac58428926
Backed out changeset bee1c344cb47 (bug 1491909) for failures in browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
dom/base/ContentBlockingLog.h
dom/media/doctor/DDLogValue.cpp
dom/media/doctor/DDLogValue.h
dom/media/doctor/DDMediaLogs.cpp
dom/notification/Notification.cpp
ipc/mscom/RegistrationAnnotator.cpp
js/public/AllocPolicy.h
memory/replace/dmd/DMD.cpp
mfbt/JSONWriter.h
mfbt/tests/TestJSONWriter.cpp
toolkit/components/places/Database.cpp
toolkit/components/telemetry/core/TelemetryHistogram.cpp
toolkit/components/telemetry/core/TelemetryHistogram.h
toolkit/components/telemetry/core/TelemetryScalar.cpp
toolkit/components/telemetry/core/TelemetryScalar.h
toolkit/components/telemetry/geckoview/TelemetryGeckoViewPersistence.cpp
tools/profiler/core/ProfileBufferEntry.cpp
tools/profiler/core/ProfileBufferEntry.h
tools/profiler/core/platform.cpp
tools/profiler/core/platform.h
tools/profiler/gecko/nsProfiler.cpp
tools/profiler/public/ProfileJSONWriter.h
xpcom/base/nsMacPreferencesReader.mm
xpcom/base/nsMemoryInfoDumper.cpp
--- a/dom/base/ContentBlockingLog.h
+++ b/dom/base/ContentBlockingLog.h
@@ -80,17 +80,17 @@ public:
       });
     }
   }
 
   nsAutoString Stringify()
   {
     nsAutoString buffer;
 
-    JSONWriter<> w(MakeUnique<StringWriteFunc>(buffer));
+    JSONWriter w(MakeUnique<StringWriteFunc>(buffer));
     w.Start();
 
     for (auto iter = mLog.Iter(); !iter.Done(); iter.Next()) {
       if (!iter.UserData()) {
         w.StartArrayProperty(NS_ConvertUTF16toUTF8(iter.Key()).get(), w.SingleLineStyle);
         w.EndArray();
         continue;
       }
--- a/dom/media/doctor/DDLogValue.cpp
+++ b/dom/media/doctor/DDLogValue.cpp
@@ -80,17 +80,17 @@ struct LogValueMatcher
 void
 AppendToString(const DDLogValue& aValue, nsCString& aString)
 {
   aValue.match(LogValueMatcher{ aString });
 }
 
 struct LogValueMatcherJson
 {
-  JSONWriter<>& mJW;
+  JSONWriter& mJW;
   const char* mPropertyName;
 
   void match(const DDNoValue&) const { mJW.NullProperty(mPropertyName); }
   void match(const DDLogObject& a) const
   {
     mJW.StringProperty(
       mPropertyName,
       nsPrintfCString(R"("%s[%p]")", a.TypeName(), a.Pointer()).get());
@@ -132,15 +132,15 @@ struct LogValueMatcherJson
                                        name.get(),
                                        a.Message().get())
                          .get());
   }
 };
 
 void
 ToJSON(const DDLogValue& aValue,
-       JSONWriter<>& aJSONWriter,
+       JSONWriter& aJSONWriter,
        const char* aPropertyName)
 {
   aValue.match(LogValueMatcherJson{ aJSONWriter, aPropertyName });
 }
 
 } // namespace mozilla
--- a/dom/media/doctor/DDLogValue.h
+++ b/dom/media/doctor/DDLogValue.h
@@ -49,19 +49,17 @@ using DDLogValue = Variant<DDNoValue,
                            double,
                            DDRange,
                            nsresult,
                            MediaResult>;
 
 void
 AppendToString(const DDLogValue& aValue, nsCString& aString);
 
-template <class AllocPolicy>
 class JSONWriter;
-class MallocAllocPolicy;
 void
 ToJSON(const DDLogValue& aValue,
-       JSONWriter<MallocAllocPolicy>& aJSONWriter,
+       JSONWriter& aJSONWriter,
        const char* aPropertyName);
 
 } // namespace mozilla
 
 #endif // DDLogValue_h_
--- a/dom/media/doctor/DDMediaLogs.cpp
+++ b/dom/media/doctor/DDMediaLogs.cpp
@@ -457,21 +457,21 @@ DDMediaLogs::FulfillPromises()
         break;
       }
       promiseHolder = std::move(mPendingPromises[0].mPromiseHolder);
       mediaElement = mPendingPromises[0].mMediaElement;
       continue;
     }
 
     nsCString json;
-    JSONWriter<> jw{ MakeUnique<StringWriteFunc>(json) };
+    JSONWriter jw{ MakeUnique<StringWriteFunc>(json) };
     jw.Start();
     jw.StartArrayProperty("messages");
     for (const DDLogMessage& message : log->mMessages) {
-      jw.StartObjectElement(JSONWriter<>::SingleLineStyle);
+      jw.StartObjectElement(JSONWriter::SingleLineStyle);
       jw.IntProperty("i", message.mIndex.Value());
       jw.DoubleProperty("ts", ToSeconds(message.mTimeStamp));
       DDLifetime* lifetime =
         mLifetimes.FindLifetime(message.mObject, message.mIndex);
       if (lifetime) {
         jw.IntProperty("ob", lifetime->mTag);
       } else {
         jw.StringProperty("ob",
@@ -500,17 +500,17 @@ DDMediaLogs::FulfillPromises()
       jw.EndObject();
     }
     jw.EndArray();
     jw.StartObjectProperty("objects");
     mLifetimes.Visit(
       mediaElement,
       [&](const DDLifetime& lifetime) {
         jw.StartObjectProperty(nsPrintfCString("%" PRIi32, lifetime.mTag).get(),
-                               JSONWriter<>::SingleLineStyle);
+                               JSONWriter::SingleLineStyle);
         jw.IntProperty("tag", lifetime.mTag);
         jw.StringProperty("cls", lifetime.mObject.TypeName());
         jw.StringProperty(
           "ptr", nsPrintfCString("%p", lifetime.mObject.Pointer()).get());
         jw.IntProperty("con", lifetime.mConstructionIndex.Value());
         jw.DoubleProperty("con_ts", ToSeconds(lifetime.mConstructionTimeStamp));
         if (lifetime.mDestructionTimeStamp) {
           jw.IntProperty("des", lifetime.mDestructionIndex.Value());
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -1737,17 +1737,17 @@ Notification::ShowInternal()
                    GetPrincipal(),
                    inPrivateBrowsing,
                    requireInteraction);
   NS_ENSURE_SUCCESS_VOID(rv);
 
   if (isPersistent) {
     nsAutoString persistentData;
 
-    JSONWriter<> w(MakeUnique<StringWriteFunc>(persistentData));
+    JSONWriter w(MakeUnique<StringWriteFunc>(persistentData));
     w.Start();
 
     nsAutoString origin;
     Notification::GetOrigin(principal, origin);
     w.StringProperty("origin", NS_ConvertUTF16toUTF8(origin).get());
 
     w.StringProperty("id", NS_ConvertUTF16toUTF8(mID).get());
 
--- a/ipc/mscom/RegistrationAnnotator.cpp
+++ b/ipc/mscom/RegistrationAnnotator.cpp
@@ -136,19 +136,19 @@ GetLoadedPath(nsAString& aPath)
     return false;
   }
 
   aPath = nsDependentString(finalPath, result);
   return true;
 }
 
 static void
-AnnotateClsidRegistrationForHive(JSONWriter<>& aJson, HKEY aHive,
+AnnotateClsidRegistrationForHive(JSONWriter& aJson, HKEY aHive,
                                  const nsAString& aClsid,
-                                 const JSONWriter<>::CollectionStyle aStyle)
+                                 const JSONWriter::CollectionStyle aStyle)
 {
   nsAutoString clsidSubkey;
   clsidSubkey.AppendLiteral(kSoftwareClasses);
   clsidSubkey.AppendLiteral(kClsid);
   clsidSubkey.Append(aClsid);
 
   nsAutoString className;
   if (GetStringValue(aHive, clsidSubkey, kDefaultValue, className)) {
@@ -188,17 +188,17 @@ AnnotateClsidRegistrationForHive(JSONWri
   if (GetStringValue(aHive, inprocHandlerSubkey, kThreadingModel,
                      handlerApartment)) {
     aJson.StringProperty("HandlerThreadingModel",
                          NS_ConvertUTF16toUTF8(handlerApartment).get());
   }
 }
 
 static void
-CheckTlbPath(JSONWriter<>& aJson, const nsAString& aTypelibPath)
+CheckTlbPath(JSONWriter& aJson, const nsAString& aTypelibPath)
 {
   const nsString& flatPath = PromiseFlatString(aTypelibPath);
   DWORD bufCharLen = ExpandEnvironmentStrings(flatPath.get(), nullptr, 0);
 
   auto buf = MakeUnique<WCHAR[]>(bufCharLen);
 
   if (!ExpandEnvironmentStrings(flatPath.get(), buf.get(), bufCharLen)) {
     return;
@@ -209,20 +209,20 @@ CheckTlbPath(JSONWriter<>& aJson, const 
   HRESULT hr = LoadTypeLibEx(buf.get(), REGKIND_NONE, getter_AddRefs(typeLib));
 
   nsPrintfCString loadResult("0x%08X", hr);
   aJson.StringProperty("LoadResult", loadResult.get());
 }
 
 template <size_t N>
 static void
-AnnotateTypelibPlatform(JSONWriter<>& aJson, HKEY aBaseKey,
+AnnotateTypelibPlatform(JSONWriter& aJson, HKEY aBaseKey,
                         const nsAString& aLcidSubkey,
                         const char16_t (&aPlatform)[N],
-                        const JSONWriter<>::CollectionStyle aStyle)
+                        const JSONWriter::CollectionStyle aStyle)
 {
   nsLiteralString platform(aPlatform);
 
   nsAutoString fullSubkey(aLcidSubkey);
   fullSubkey.AppendLiteral(kBackslash);
   fullSubkey.Append(platform);
 
   nsAutoString tlbPath;
@@ -230,20 +230,20 @@ AnnotateTypelibPlatform(JSONWriter<>& aJ
     aJson.StartObjectProperty(NS_ConvertUTF16toUTF8(platform).get(), aStyle);
     aJson.StringProperty("Path", NS_ConvertUTF16toUTF8(tlbPath).get());
     CheckTlbPath(aJson, tlbPath);
     aJson.EndObject();
   }
 }
 
 static void
-AnnotateTypelibRegistrationForHive(JSONWriter<>& aJson, HKEY aHive,
+AnnotateTypelibRegistrationForHive(JSONWriter& aJson, HKEY aHive,
                                    const nsAString& aTypelibId,
                                    const nsAString& aTypelibVersion,
-                                   const JSONWriter<>::CollectionStyle aStyle)
+                                   const JSONWriter::CollectionStyle aStyle)
 {
   nsAutoString typelibSubKey;
   typelibSubKey.AppendLiteral(kSoftwareClasses);
   typelibSubKey.AppendLiteral(kTypeLib);
   typelibSubKey.AppendLiteral(kBackslash);
   typelibSubKey.Append(aTypelibId);
   typelibSubKey.AppendLiteral(kBackslash);
   typelibSubKey.Append(aTypelibVersion);
@@ -288,18 +288,18 @@ AnnotateTypelibRegistrationForHive(JSONW
       AnnotateTypelibPlatform(aJson, typelibKey, strLcid, kWin64, aStyle);
 #endif
       aJson.EndObject();
     }
   }
 }
 
 static void
-AnnotateInterfaceRegistrationForHive(JSONWriter<>& aJson, HKEY aHive, REFIID aIid,
-                                     const JSONWriter<>::CollectionStyle aStyle)
+AnnotateInterfaceRegistrationForHive(JSONWriter& aJson, HKEY aHive, REFIID aIid,
+                                     const JSONWriter::CollectionStyle aStyle)
 {
   nsAutoString interfaceSubKey;
   interfaceSubKey.AppendLiteral(kSoftwareClasses);
   interfaceSubKey.AppendLiteral(kInterface);
   nsAutoString iid;
   GUIDToString(aIid, iid);
   interfaceSubKey.Append(iid);
 
@@ -352,22 +352,22 @@ AnnotateInterfaceRegistrationForHive(JSO
     aJson.EndObject();
   }
 }
 
 void
 AnnotateInterfaceRegistration(REFIID aIid)
 {
 #if defined(DEBUG)
-  const JSONWriter<>::CollectionStyle style = JSONWriter<>::MultiLineStyle;
+  const JSONWriter::CollectionStyle style = JSONWriter::MultiLineStyle;
 #else
-  const JSONWriter<>::CollectionStyle style = JSONWriter<>::SingleLineStyle;
+  const JSONWriter::CollectionStyle style = JSONWriter::SingleLineStyle;
 #endif
 
-  JSONWriter<> json(MakeUnique<CStringWriter>());
+  JSONWriter json(MakeUnique<CStringWriter>());
 
   json.Start(style);
 
   json.StartObjectProperty("HKLM", style);
   AnnotateInterfaceRegistrationForHive(json, HKEY_LOCAL_MACHINE, aIid, style);
   json.EndObject();
 
   json.StartObjectProperty("HKCU", style);
@@ -386,25 +386,25 @@ AnnotateInterfaceRegistration(REFIID aIi
     annotationKey,
     static_cast<CStringWriter*>(json.WriteFunc())->Get());
 }
 
 void
 AnnotateClassRegistration(REFCLSID aClsid)
 {
 #if defined(DEBUG)
-  const JSONWriter<>::CollectionStyle style = JSONWriter<>::MultiLineStyle;
+  const JSONWriter::CollectionStyle style = JSONWriter::MultiLineStyle;
 #else
-  const JSONWriter<>::CollectionStyle style = JSONWriter<>::SingleLineStyle;
+  const JSONWriter::CollectionStyle style = JSONWriter::SingleLineStyle;
 #endif
 
   nsAutoString strClsid;
   GUIDToString(aClsid, strClsid);
 
-  JSONWriter<> json(MakeUnique<CStringWriter>());
+  JSONWriter json(MakeUnique<CStringWriter>());
 
   json.Start(style);
 
   json.StartObjectProperty("HKLM", style);
   AnnotateClsidRegistrationForHive(json, HKEY_LOCAL_MACHINE, strClsid, style);
   json.EndObject();
 
   json.StartObjectProperty("HKCU", style);
--- a/js/public/AllocPolicy.h
+++ b/js/public/AllocPolicy.h
@@ -129,13 +129,9 @@ class TempAllocPolicy : public AllocPoli
         }
 
         return true;
     }
 };
 
 } /* namespace js */
 
-namespace JS {
-using SystemAllocPolicy = js::SystemAllocPolicy;
-} /* namespace JS */
-
 #endif /* js_AllocPolicy_h */
--- a/memory/replace/dmd/DMD.cpp
+++ b/memory/replace/dmd/DMD.cpp
@@ -1784,17 +1784,17 @@ public:
     return kPtrBuf;
   }
 
 private:
   char kPtrBuf[32];
 };
 
 static void
-WriteBlockContents(JSONWriter<>& aWriter, const LiveBlock& aBlock)
+WriteBlockContents(JSONWriter& aWriter, const LiveBlock& aBlock)
 {
   size_t numWords = aBlock.ReqSize() / sizeof(uintptr_t*);
   if (numWords == 0) {
     return;
   }
 
   aWriter.StartArrayProperty("contents", aWriter.SingleLineStyle);
   {
@@ -1812,17 +1812,17 @@ AnalyzeImpl(UniquePtr<JSONWriteFunc> aWr
 {
   // Some blocks may have been allocated while creating |aWriter|. Those blocks
   // will be freed at the end of this function when |write| is destroyed. The
   // allocations will have occurred while intercepts were not blocked, so the
   // frees better be as well, otherwise we'll get assertion failures.
   // Therefore, this declaration must precede the AutoBlockIntercepts
   // declaration, to ensure that |write| is destroyed *after* intercepts are
   // unblocked.
-  JSONWriter<> writer(std::move(aWriter));
+  JSONWriter writer(std::move(aWriter));
 
   AutoBlockIntercepts block(Thread::Fetch());
   AutoLockState lock;
 
   // Allocate this on the heap instead of the stack because it's fairly large.
   auto locService = InfallibleAllocPolicy::new_<CodeAddressService>();
 
   StackTraceSet usedStackTraces(512);
--- a/mfbt/JSONWriter.h
+++ b/mfbt/JSONWriter.h
@@ -115,17 +115,16 @@ public:
 };
 
 // Ideally this would be within |EscapedString| but when compiling with GCC
 // on Linux that caused link errors, whereas this formulation didn't.
 namespace detail {
 extern MFBT_DATA const char gTwoCharEscapes[256];
 } // namespace detail
 
-template <class AllocPolicy = MallocAllocPolicy>
 class JSONWriter
 {
   // From http://www.ietf.org/rfc/rfc4627.txt:
   //
   //   "All Unicode characters may be placed within the quotation marks except
   //   for the characters that must be escaped: quotation mark, reverse
   //   solidus, and the control characters (U+0000 through U+001F)."
   //
@@ -138,42 +137,30 @@ class JSONWriter
   //
   class EscapedString
   {
     // Only one of |mUnownedStr| and |mOwnedStr| are ever non-null. |mIsOwned|
     // indicates which one is in use. They're not within a union because that
     // wouldn't work with UniquePtr.
     bool mIsOwned;
     const char* mUnownedStr;
-
-    struct FreePolicy {
-      AllocPolicy mAllocPolicy;
-      void operator() (void* p) {
-        mAllocPolicy.free_(p);
-      }
-    };
-
-    UniquePtr<char[], FreePolicy> mOwnedStr;
+    UniquePtr<char[]> mOwnedStr;
 
     void SanityCheck() const
     {
       MOZ_ASSERT_IF( mIsOwned,  mOwnedStr.get() && !mUnownedStr);
       MOZ_ASSERT_IF(!mIsOwned, !mOwnedStr.get() &&  mUnownedStr);
     }
 
     static char hexDigitToAsciiChar(uint8_t u)
     {
       u = u & 0xf;
       return u < 10 ? '0' + u : 'a' + (u - 10);
     }
 
-    AllocPolicy& allocPolicy() {
-      return mOwnedStr.get_deleter().mAllocPolicy;
-    }
-
   public:
     explicit EscapedString(const char* aStr)
       : mUnownedStr(nullptr)
       , mOwnedStr(nullptr)
     {
       const char* p;
 
       // First, see if we need to modify the string.
@@ -197,18 +184,17 @@ class JSONWriter
         mIsOwned = false;
         mUnownedStr = aStr;
         return;
       }
 
       // Escapes are needed. We'll create a new string.
       mIsOwned = true;
       size_t len = (p - aStr) + nExtra;
-      UniquePtr<char[], FreePolicy> buffer(allocPolicy().template pod_malloc<char>(len + 1));
-      mOwnedStr = std::move(buffer);
+      mOwnedStr = MakeUnique<char[]>(len + 1);
 
       p = aStr;
       size_t i = 0;
 
       while (true) {
         uint8_t u = *p;   // ensure it can't be interpreted as negative
         if (u == 0) {
           mOwnedStr[i] = 0;
--- a/mfbt/tests/TestJSONWriter.cpp
+++ b/mfbt/tests/TestJSONWriter.cpp
@@ -96,17 +96,17 @@ void TestBasicProperties()
   \"three\": 3,\n\
   \"four\": 4,\n\
   \"five\": 5\n\
  },\n\
  \"len 3 object, single-line\": {\"a\": 1, \"b\": [{}, 2, []], \"c\": 3}\n\
 }\n\
 ";
 
-  JSONWriter<> w(MakeUnique<StringWriteFunc>());
+  JSONWriter w(MakeUnique<StringWriteFunc>());
 
   w.Start();
   {
     w.NullProperty("null");
 
     w.BoolProperty("bool1", true);
     w.BoolProperty("bool2", false);
 
@@ -255,17 +255,17 @@ void TestBasicElements()
    \"four\": 4,\n\
    \"five\": 5\n\
   },\n\
   {\"a\": 1, \"b\": [{}, 2, []], \"c\": 3}\n\
  ]\n\
 }\n\
 ";
 
-  JSONWriter<> w(MakeUnique<StringWriteFunc>());
+  JSONWriter w(MakeUnique<StringWriteFunc>());
 
   w.Start();
   w.StartArrayProperty("array");
   {
     w.NullElement();
 
     w.BoolElement(true);
     w.BoolElement(false);
@@ -371,17 +371,17 @@ void TestBasicElements()
 }
 
 void TestOneLineObject()
 {
   const char* expected = "\
 {\"i\": 1, \"array\": [null, [{}], {\"o\": {}}, \"s\"], \"d\": 3.33}\n\
 ";
 
-  JSONWriter<> w(MakeUnique<StringWriteFunc>());
+  JSONWriter w(MakeUnique<StringWriteFunc>());
 
   w.Start(w.SingleLineStyle);
 
   w.IntProperty("i", 1);
 
   w.StartArrayProperty("array");
   {
     w.NullElement();
@@ -425,17 +425,17 @@ void TestStringEscaping()
  \"hall\xC3\xB3 \xC3\xBE" "arna\": 4660,\n\
  \"\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF\": {\n\
   \"\xD0\xBF\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82\": [\n\
   ]\n\
  }\n\
 }\n\
 ";
 
-  JSONWriter<> w(MakeUnique<StringWriteFunc>());
+  JSONWriter w(MakeUnique<StringWriteFunc>());
 
   // Test the string escaping behaviour.
   w.Start();
   {
     // Test all 127 ascii values. Do it in reverse order so that the 0
     // at the end serves as the null char.
     char buf[128];
     for (int i = 0; i < 128; i++) {
@@ -503,17 +503,17 @@ void TestDeepNesting()
      ]\n\
     }\n\
    ]\n\
   }\n\
  ]\n\
 }\n\
 ";
 
-  JSONWriter<> w(MakeUnique<StringWriteFunc>());
+  JSONWriter w(MakeUnique<StringWriteFunc>());
 
   w.Start();
   {
     static const int n = 10;
     for (int i = 0; i < n; i++) {
       w.StartArrayProperty("a");
       w.StartObjectElement();
     }
@@ -528,17 +528,17 @@ void TestDeepNesting()
 }
 
 void TestEscapedPropertyNames()
 {
   const char* expected = "\
 {\"i\\t\": 1, \"array\\t\": [null, [{}], {\"o\\t\": {}}, \"s\"], \"d\\t\": 3.33}\n\
 ";
 
-  JSONWriter<> w(MakeUnique<StringWriteFunc>());
+  JSONWriter w(MakeUnique<StringWriteFunc>());
 
   w.Start(w.SingleLineStyle);
 
   w.IntProperty("i\t", 1);
 
   w.StartArrayProperty("array\t");
   {
     w.NullElement();
--- a/toolkit/components/places/Database.cpp
+++ b/toolkit/components/places/Database.cpp
@@ -2579,18 +2579,18 @@ Database::MigrateV51Up()
     return NS_OK;
   };
 
   rv = stmt->BindUTF8StringByName(NS_LITERAL_CSTRING("anno_name"),
                                   LAST_USED_ANNO);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString json;
-  JSONWriter<> jw{ MakeUnique<StringWriteFunc>(json) };
-  jw.StartArrayProperty(nullptr, JSONWriter<>::SingleLineStyle);
+  JSONWriter jw{ MakeUnique<StringWriteFunc>(json) };
+  jw.StartArrayProperty(nullptr, JSONWriter::SingleLineStyle);
 
   bool hasAtLeastOne = false;
   bool hasMore = false;
   uint32_t length;
   while (NS_SUCCEEDED(stmt->ExecuteStep(&hasMore)) && hasMore) {
     hasAtLeastOne = true;
     jw.StringElement(stmt->AsSharedUTF8String(0, &length));
   }
--- a/toolkit/components/telemetry/core/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/core/TelemetryHistogram.cpp
@@ -2633,17 +2633,17 @@ namespace {
 /**
  * Helper function to write histogram properties to JSON.
  * Please note that this needs to be called between
  * StartObjectProperty/EndObject calls that mark the histogram's
  * JSON creation.
  */
 void
 internal_ReflectHistogramToJSON(const HistogramSnapshotData& aSnapshot,
-                                mozilla::JSONWriter<>& aWriter)
+                                mozilla::JSONWriter& aWriter)
 {
   aWriter.IntProperty("sum", aSnapshot.mSampleSum);
 
   // Fill the "counts" property.
   aWriter.StartArrayProperty("counts");
   for (size_t i = 0; i < aSnapshot.mBucketCounts.Length(); i++) {
     aWriter.IntElement(aSnapshot.mBucketCounts[i]);
   }
@@ -2760,17 +2760,17 @@ internal_ParseHistogramData(JSContext* a
 } // Anonymous namespace
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // PUBLIC: GeckoView serialization/deserialization functions.
 
 nsresult
-TelemetryHistogram::SerializeHistograms(mozilla::JSONWriter<>& aWriter)
+TelemetryHistogram::SerializeHistograms(mozilla::JSONWriter& aWriter)
 {
   MOZ_ASSERT(XRE_IsParentProcess(), "Only save histograms in the parent process");
   if (!XRE_IsParentProcess()) {
     return NS_ERROR_FAILURE;
   }
 
   // Include the GPU process in histogram snapshots only if we actually tried
   // to launch a process for it.
@@ -2807,17 +2807,17 @@ TelemetryHistogram::SerializeHistograms(
     }
     aWriter.EndObject();
   }
 
   return NS_OK;
 }
 
 nsresult
-TelemetryHistogram::SerializeKeyedHistograms(mozilla::JSONWriter<>& aWriter)
+TelemetryHistogram::SerializeKeyedHistograms(mozilla::JSONWriter& aWriter)
 {
   MOZ_ASSERT(XRE_IsParentProcess(), "Only save keyed histograms in the parent process");
   if (!XRE_IsParentProcess()) {
     return NS_ERROR_FAILURE;
   }
 
   // Include the GPU process in histogram snapshots only if we actually tried
   // to launch a process for it.
--- a/toolkit/components/telemetry/core/TelemetryHistogram.h
+++ b/toolkit/components/telemetry/core/TelemetryHistogram.h
@@ -8,20 +8,19 @@
 
 #include "mozilla/TelemetryComms.h"
 #include "mozilla/TelemetryHistogramEnums.h"
 #include "mozilla/TelemetryProcessEnums.h"
 #include "nsXULAppAPI.h"
 
 namespace mozilla{
 // This is only used for the GeckoView persistence.
-template <class AllocPolicy>
 class JSONWriter;
-class MallocAllocPolicy;
 }
+
 // This module is internal to Telemetry.  It encapsulates Telemetry's
 // histogram accumulation and storage logic.  It should only be used by
 // Telemetry.cpp.  These functions should not be used anywhere else.
 // For the public interface to Telemetry functionality, see Telemetry.h.
 
 namespace TelemetryHistogram {
 
 void InitializeGlobalState(bool canRecordBase, bool canRecordExtended);
@@ -77,16 +76,16 @@ GetKeyedHistogramSnapshots(JSContext *aC
                            bool aClearSubsession);
 
 size_t
 GetHistogramSizesOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
 
 // These functions are only meant to be used for GeckoView persistence.
 // They are responsible for updating in-memory probes with the data persisted
 // on the disk and vice-versa.
-nsresult SerializeHistograms(mozilla::JSONWriter<mozilla::MallocAllocPolicy>& aWriter);
-nsresult SerializeKeyedHistograms(mozilla::JSONWriter<mozilla::MallocAllocPolicy>& aWriter);
+nsresult SerializeHistograms(mozilla::JSONWriter &aWriter);
+nsresult SerializeKeyedHistograms(mozilla::JSONWriter &aWriter);
 nsresult DeserializeHistograms(JSContext* aCx, JS::HandleValue aData);
 nsresult DeserializeKeyedHistograms(JSContext* aCx, JS::HandleValue aData);
 
 } // namespace TelemetryHistogram
 
 #endif // TelemetryHistogram_h__
--- a/toolkit/components/telemetry/core/TelemetryScalar.cpp
+++ b/toolkit/components/telemetry/core/TelemetryScalar.cpp
@@ -267,17 +267,17 @@ GetVariantFromIVariant(nsIVariant* aInpu
   return ScalarResult::Ok;
 }
 
 /**
  * Write a nsIVariant with a JSONWriter, used for GeckoView persistence.
  */
 nsresult
 WriteVariantToJSONWriter(uint32_t aScalarType, nsIVariant* aInputValue,
-                         const char* aPropertyName, mozilla::JSONWriter<>& aWriter)
+                         const char* aPropertyName, mozilla::JSONWriter& aWriter)
 {
   MOZ_ASSERT(aInputValue);
 
   switch (aScalarType) {
     case nsITelemetry::SCALAR_TYPE_COUNT:
       {
         uint32_t val = 0;
         nsresult rv = aInputValue->GetAsUint32(&val);
@@ -3475,17 +3475,17 @@ TelemetryScalar::AddDynamicScalarDefinit
  * Write the scalar data to the provided Json object, for
  * GeckoView measurement persistence. The output format is the same one used
  * for snapshotting the scalars.
  *
  * @param {aWriter} The JSON object to write to.
  * @returns NS_OK or a failure value explaining why persistence failed.
  */
 nsresult
-TelemetryScalar::SerializeScalars(mozilla::JSONWriter<>& aWriter)
+TelemetryScalar::SerializeScalars(mozilla::JSONWriter& aWriter)
 {
   // Get a copy of the data, without clearing.
   ScalarSnapshotTable scalarsToReflect;
   {
     StaticMutexAutoLock locker(gTelemetryScalarsMutex);
     // For persistence, we care about all the datasets. Worst case, they
     // will be empty.
     nsresult rv = internal_GetScalarSnapshot(locker,
@@ -3526,17 +3526,17 @@ TelemetryScalar::SerializeScalars(mozill
  * Write the keyed scalar data to the provided Json object, for
  * GeckoView measurement persistence. The output format is the same
  * one used for snapshotting the keyed scalars.
  *
  * @param {aWriter} The JSON object to write to.
  * @returns NS_OK or a failure value explaining why persistence failed.
  */
 nsresult
-TelemetryScalar::SerializeKeyedScalars(mozilla::JSONWriter<>& aWriter)
+TelemetryScalar::SerializeKeyedScalars(mozilla::JSONWriter& aWriter)
 {
   // Get a copy of the data, without clearing.
   KeyedScalarSnapshotTable keyedScalarsToReflect;
   {
     StaticMutexAutoLock locker(gTelemetryScalarsMutex);
     // For persistence, we care about all the datasets. Worst case, they
     // will be empty.
     nsresult rv = internal_GetKeyedScalarSnapshot(locker,
--- a/toolkit/components/telemetry/core/TelemetryScalar.h
+++ b/toolkit/components/telemetry/core/TelemetryScalar.h
@@ -13,19 +13,17 @@
 
 // This module is internal to Telemetry. It encapsulates Telemetry's
 // scalar accumulation and storage logic. It should only be used by
 // Telemetry.cpp. These functions should not be used anywhere else.
 // For the public interface to Telemetry functionality, see Telemetry.h.
 
 namespace mozilla {
 // This is only used for the GeckoView persistence.
-template <class AllocPolicy>
 class JSONWriter;
-class MallocAllocPolicy;
 namespace Telemetry {
   struct ScalarAction;
   struct KeyedScalarAction;
   struct DiscardedData;
   struct DynamicScalarDefinition;
 } // namespace Telemetry
 } // namespace mozilla
 
@@ -91,18 +89,18 @@ void UpdateChildKeyedData(mozilla::Telem
 void RecordDiscardedData(mozilla::Telemetry::ProcessID aProcessType,
                          const mozilla::Telemetry::DiscardedData& aDiscardedData);
 
 void GetDynamicScalarDefinitions(nsTArray<mozilla::Telemetry::DynamicScalarDefinition>&);
 void AddDynamicScalarDefinitions(const nsTArray<mozilla::Telemetry::DynamicScalarDefinition>&);
 
 // They are responsible for updating in-memory probes with the data persisted
 // on the disk and vice-versa.
-nsresult SerializeScalars(mozilla::JSONWriter<mozilla::MallocAllocPolicy>& aWriter);
-nsresult SerializeKeyedScalars(mozilla::JSONWriter<mozilla::MallocAllocPolicy>& aWriter);
+nsresult SerializeScalars(mozilla::JSONWriter &aWriter);
+nsresult SerializeKeyedScalars(mozilla::JSONWriter &aWriter);
 nsresult DeserializePersistedScalars(JSContext* aCx, JS::HandleValue aData);
 nsresult DeserializePersistedKeyedScalars(JSContext* aCx, JS::HandleValue aData);
 // Mark deserialization as in progress.
 // After this, all scalar operations are recorded into the pending operations list.
 void DeserializationStarted();
 // Apply all operations from the pending operations list and mark deserialization finished afterwards.
 void ApplyPendingOperations();
 } // namespace TelemetryScalar
--- a/toolkit/components/telemetry/geckoview/TelemetryGeckoViewPersistence.cpp
+++ b/toolkit/components/telemetry/geckoview/TelemetryGeckoViewPersistence.cpp
@@ -377,17 +377,17 @@ PersistenceThreadPersist()
     mozilla::MakeUnique<StreamingJSONWriter>();
 
   if (!jsonWriter || NS_FAILED(jsonWriter->Open(persistenceFile))) {
     ANDROID_LOG("PersistenceThreadPersist - There was an error opening the persistence file.");
     return;
   }
 
   // Build the JSON structure: give up the ownership of jsonWriter.
-  mozilla::JSONWriter<> w(std::move(jsonWriter));
+  mozilla::JSONWriter w(std::move(jsonWriter));
   w.Start();
 
   w.StartObjectProperty("scalars");
   if (NS_FAILED(TelemetryScalar::SerializeScalars(w))) {
     ANDROID_LOG("Persist - Failed to persist scalars.");
   }
   w.EndObject();
 
--- a/tools/profiler/core/ProfileBufferEntry.cpp
+++ b/tools/profiler/core/ProfileBufferEntry.cpp
@@ -80,21 +80,21 @@ ProfileBufferEntry::ProfileBufferEntry(K
   u.mUint64 = aUint64;
 }
 
 // END ProfileBufferEntry
 ////////////////////////////////////////////////////////////////////////
 
 class JSONSchemaWriter
 {
-  ProfilerJSONWriter& mWriter;
+  JSONWriter& mWriter;
   uint32_t mIndex;
 
 public:
-  explicit JSONSchemaWriter(ProfilerJSONWriter& aWriter)
+  explicit JSONSchemaWriter(JSONWriter& aWriter)
    : mWriter(aWriter)
    , mIndex(0)
   {
     aWriter.StartObjectProperty("schema",
                                 SpliceableJSONWriter::SingleLineStyle);
   }
 
   void WriteField(const char* aName) {
--- a/tools/profiler/core/ProfileBufferEntry.h
+++ b/tools/profiler/core/ProfileBufferEntry.h
@@ -135,21 +135,21 @@ class UniqueJSONStrings
 public:
   UniqueJSONStrings();
   explicit UniqueJSONStrings(const UniqueJSONStrings& aOther);
 
   void SpliceStringTableElements(SpliceableJSONWriter& aWriter) {
     aWriter.TakeAndSplice(mStringTableWriter.WriteFunc());
   }
 
-  void WriteProperty(ProfilerJSONWriter& aWriter, const char* aName, const char* aStr) {
+  void WriteProperty(mozilla::JSONWriter& aWriter, const char* aName, const char* aStr) {
     aWriter.IntProperty(aName, GetOrAddIndex(aStr));
   }
 
-  void WriteElement(ProfilerJSONWriter& aWriter, const char* aStr) {
+  void WriteElement(mozilla::JSONWriter& aWriter, const char* aStr) {
     aWriter.IntElement(GetOrAddIndex(aStr));
   }
 
   uint32_t GetOrAddIndex(const char* aStr);
 
 private:
   SpliceableChunkedJSONWriter mStringTableWriter;
   nsDataHashtable<nsCStringHashKey, uint32_t> mStringToIndexMap;
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -1562,44 +1562,44 @@ DoPeriodicSample(PSLockRef aLock, Regist
 const static uint64_t kJS_MAX_SAFE_UINTEGER = +9007199254740991ULL;
 
 static int64_t
 SafeJSInteger(uint64_t aValue) {
   return aValue <= kJS_MAX_SAFE_UINTEGER ? int64_t(aValue) : -1;
 }
 
 static void
-AddSharedLibraryInfoToStream(ProfilerJSONWriter& aWriter, const SharedLibrary& aLib)
+AddSharedLibraryInfoToStream(JSONWriter& aWriter, const SharedLibrary& aLib)
 {
   aWriter.StartObjectElement();
   aWriter.IntProperty("start", SafeJSInteger(aLib.GetStart()));
   aWriter.IntProperty("end", SafeJSInteger(aLib.GetEnd()));
   aWriter.IntProperty("offset", SafeJSInteger(aLib.GetOffset()));
   aWriter.StringProperty("name", NS_ConvertUTF16toUTF8(aLib.GetModuleName()).get());
   aWriter.StringProperty("path", NS_ConvertUTF16toUTF8(aLib.GetModulePath()).get());
   aWriter.StringProperty("debugName", NS_ConvertUTF16toUTF8(aLib.GetDebugName()).get());
   aWriter.StringProperty("debugPath", NS_ConvertUTF16toUTF8(aLib.GetDebugPath()).get());
   aWriter.StringProperty("breakpadId", aLib.GetBreakpadId().get());
   aWriter.StringProperty("arch", aLib.GetArch().c_str());
   aWriter.EndObject();
 }
 
 void
-AppendSharedLibraries(ProfilerJSONWriter& aWriter)
+AppendSharedLibraries(JSONWriter& aWriter)
 {
   SharedLibraryInfo info = SharedLibraryInfo::GetInfoForSelf();
   info.SortByAddress();
   for (size_t i = 0; i < info.GetSize(); i++) {
     AddSharedLibraryInfoToStream(aWriter, info.GetEntry(i));
   }
 }
 
 #ifdef MOZ_TASK_TRACER
 static void
-StreamNameAndThreadId(ProfilerJSONWriter& aWriter, const char* aName, int aThreadId)
+StreamNameAndThreadId(JSONWriter& aWriter, const char* aName, int aThreadId)
 {
   aWriter.StartObjectElement();
   {
     if (XRE_GetProcessType() == GeckoProcessType_Plugin) {
       // TODO Add the proper plugin name
       aWriter.StringProperty("name", "Plugin");
     } else {
       aWriter.StringProperty("name", aName);
@@ -1818,17 +1818,17 @@ StreamMetaJSCustomObject(PSLockRef aLock
       }
 
       aWriter.StartArrayProperty("data");
       {
         nsTArray<RefPtr<WebExtensionPolicy>> exts;
         ExtensionPolicyService::GetSingleton().GetAll(exts);
 
         for (auto& ext : exts) {
-          aWriter.StartArrayElement(ProfilerJSONWriter::SingleLineStyle);
+          aWriter.StartArrayElement(JSONWriter::SingleLineStyle);
 
           nsAutoString id;
           ext->GetId(id);
           aWriter.StringElement(NS_ConvertUTF16toUTF8(id).get());
 
           aWriter.StringElement(NS_ConvertUTF16toUTF8(ext->Name()).get());
 
           auto url = ext->GetURL(NS_LITERAL_STRING(""));
--- a/tools/profiler/core/platform.h
+++ b/tools/profiler/core/platform.h
@@ -35,17 +35,16 @@
 #include "ThreadResponsiveness.h"
 #include "mozilla/Logging.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/StaticMutex.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Unused.h"
 #include "PlatformMacros.h"
-#include "ProfileJSONWriter.h"
 #include <vector>
 
 // We need a definition of gettid(), but glibc doesn't provide a
 // wrapper for it.
 #if defined(__GLIBC__)
 #include <unistd.h>
 #include <sys/syscall.h>
 static inline pid_t gettid()
@@ -112,19 +111,17 @@ struct PlatformDataDestructor {
   void operator()(PlatformData*);
 };
 
 typedef mozilla::UniquePtr<PlatformData, PlatformDataDestructor>
   UniquePlatformData;
 UniquePlatformData AllocPlatformData(int aThreadId);
 
 namespace mozilla {
-template <class AllocPolicy>
 class JSONWriter;
-class MallocAllocPolicy;
 }
-void AppendSharedLibraries(ProfilerJSONWriter& aWriter);
+void AppendSharedLibraries(mozilla::JSONWriter& aWriter);
 
 // Convert the array of strings to a bitfield.
 uint32_t ParseFeaturesFromStringArray(const char** aFeatures,
                                       uint32_t aFeatureCount);
 
 #endif /* ndef TOOLS_PLATFORM_H_ */
--- a/tools/profiler/gecko/nsProfiler.cpp
+++ b/tools/profiler/gecko/nsProfiler.cpp
@@ -188,17 +188,17 @@ namespace {
 
 NS_IMETHODIMP
 nsProfiler::GetSharedLibraries(JSContext* aCx,
                                JS::MutableHandle<JS::Value> aResult)
 {
   JS::RootedValue val(aCx);
   {
     nsString buffer;
-    ProfilerJSONWriter w(MakeUnique<StringWriteFunc>(buffer));
+    JSONWriter w(MakeUnique<StringWriteFunc>(buffer));
     w.StartArrayElement();
     AppendSharedLibraries(w);
     w.EndArray();
     MOZ_ALWAYS_TRUE(JS_ParseJSON(aCx, static_cast<const char16_t*>(buffer.get()),
                                  buffer.Length(), &val));
   }
   JS::RootedObject obj(aCx, &val.toObject());
   if (!obj) {
--- a/tools/profiler/public/ProfileJSONWriter.h
+++ b/tools/profiler/public/ProfileJSONWriter.h
@@ -5,24 +5,19 @@
 
 #ifndef PROFILEJSONWRITER_H
 #define PROFILEJSONWRITER_H
 
 #include <ostream>
 #include <string>
 #include <string.h>
 
-#include "js/AllocPolicy.h"
 #include "mozilla/JSONWriter.h"
 #include "mozilla/UniquePtr.h"
 
-// JS::SystemAllocPolicy is used here instead of the default so that the JSONWriter
-// object can also be passed into SpiderMonkey and used there.
-using ProfilerJSONWriter = mozilla::JSONWriter<JS::SystemAllocPolicy>;
-
 class SpliceableChunkedJSONWriter;
 
 // On average, profile JSONs are large enough such that we want to avoid
 // reallocating its buffer when expanding. Additionally, the contents of the
 // profile are not accessed until the profile is entirely written. For these
 // reasons we use a chunked writer that keeps an array of chunks, which is
 // concatenated together after writing is finished.
 class ChunkedJSONWriteFunc : public mozilla::JSONWriteFunc
@@ -83,21 +78,21 @@ struct OStreamJSONWriteFunc : public moz
 
   void Write(const char* aStr) override {
     mStream << aStr;
   }
 
   std::ostream& mStream;
 };
 
-class SpliceableJSONWriter : public ProfilerJSONWriter
+class SpliceableJSONWriter : public mozilla::JSONWriter
 {
 public:
   explicit SpliceableJSONWriter(mozilla::UniquePtr<mozilla::JSONWriteFunc> aWriter)
-    : ProfilerJSONWriter(std::move(aWriter))
+    : JSONWriter(std::move(aWriter))
   { }
 
   void StartBareList(CollectionStyle aStyle = MultiLineStyle) {
     StartCollection(nullptr, "", aStyle);
   }
 
   void EndBareList() {
     EndCollection("");
--- a/xpcom/base/nsMacPreferencesReader.mm
+++ b/xpcom/base/nsMacPreferencesReader.mm
@@ -20,20 +20,20 @@ struct StringWriteFunc : public JSONWrit
   }
   void Write(const char* aStr) override
   {
     mString.Append(NS_ConvertUTF8toUTF16(aStr));
   }
 };
 
 static void
-EvaluateDict(JSONWriter<>* aWriter, NSDictionary<NSString*, id>* aDict);
+EvaluateDict(JSONWriter* aWriter, NSDictionary<NSString*, id>* aDict);
 
 static void
-EvaluateArray(JSONWriter<>* aWriter, NSArray* aArray)
+EvaluateArray(JSONWriter* aWriter, NSArray* aArray)
 {
   for (id elem in aArray) {
     if ([elem isKindOfClass:[NSString class]]) {
       aWriter->StringElement([elem UTF8String]);
     } else if ([elem isKindOfClass:[NSNumber class]]) {
       aWriter->IntElement([elem longLongValue]);
     } else if ([elem isKindOfClass:[NSArray class]]) {
       aWriter->StartArrayElement();
@@ -43,17 +43,17 @@ EvaluateArray(JSONWriter<>* aWriter, NSA
       aWriter->StartObjectElement();
       EvaluateDict(aWriter, elem);
       aWriter->EndObject();
     }
   }
 }
 
 static void
-EvaluateDict(JSONWriter<>* aWriter, NSDictionary<NSString*, id>* aDict)
+EvaluateDict(JSONWriter* aWriter, NSDictionary<NSString*, id>* aDict)
 {
   for (NSString* key in aDict) {
     id value = aDict[key];
     if ([value isKindOfClass:[NSString class]]) {
       aWriter->StringProperty([key UTF8String], [value UTF8String]);
     } else if ([value isKindOfClass:[NSNumber class]]) {
       aWriter->IntProperty([key UTF8String], [value longLongValue]);
     } else if ([value isKindOfClass:[NSArray class]]) {
@@ -78,17 +78,17 @@ nsMacPreferencesReader::PoliciesEnabled(
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMacPreferencesReader::ReadPreferences(JSContext* aCx,
                                         JS::MutableHandle<JS::Value> aResult)
 {
   nsAutoString jsonStr;
-  JSONWriter<> w(MakeUnique<StringWriteFunc>(jsonStr));
+  JSONWriter w(MakeUnique<StringWriteFunc>(jsonStr));
   w.Start();
   EvaluateDict(&w, [[NSUserDefaults standardUserDefaults]
                      dictionaryRepresentation]);
   w.End();
 
   auto json = static_cast<const char16_t*>(jsonStr.get());
 
   JS::RootedValue val(aCx);
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -464,17 +464,17 @@ private:
 // the end of reporting. Both the callbacks need access to the same JSONWriter,
 // so we implement both of them in this one class.
 class HandleReportAndFinishReportingCallbacks final
   : public nsIHandleReportCallback, public nsIFinishReportingCallback
 {
 public:
   NS_DECL_ISUPPORTS
 
-  HandleReportAndFinishReportingCallbacks(UniquePtr<JSONWriter<>> aWriter,
+  HandleReportAndFinishReportingCallbacks(UniquePtr<JSONWriter> aWriter,
                                           nsIFinishDumpingCallback* aFinishDumping,
                                           nsISupports* aFinishDumpingData)
     : mWriter(std::move(aWriter))
     , mFinishDumping(aFinishDumping)
     , mFinishDumpingData(aFinishDumpingData)
   {
   }
 
@@ -540,17 +540,17 @@ public:
     }
 
     return mFinishDumping->Callback(mFinishDumpingData);
   }
 
 private:
   ~HandleReportAndFinishReportingCallbacks() {}
 
-  UniquePtr<JSONWriter<>> mWriter;
+  UniquePtr<JSONWriter> mWriter;
   nsCOMPtr<nsIFinishDumpingCallback> mFinishDumping;
   nsCOMPtr<nsISupports> mFinishDumpingData;
 };
 
 NS_IMPL_ISUPPORTS(HandleReportAndFinishReportingCallbacks,
                   nsIHandleReportCallback, nsIFinishReportingCallback)
 
 class TempDirFinishCallback final : public nsIFinishDumpingCallback
@@ -644,17 +644,17 @@ DumpMemoryInfoToFile(
   nsAString& aDMDIdentifier)
 {
   RefPtr<nsGZFileWriter> gzWriter = new nsGZFileWriter();
   nsresult rv = gzWriter->Init(aReportsFile);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   auto jsonWriter =
-    MakeUnique<JSONWriter<>>(MakeUnique<GZWriterWrapper>(gzWriter));
+    MakeUnique<JSONWriter>(MakeUnique<GZWriterWrapper>(gzWriter));
 
   nsCOMPtr<nsIMemoryReporterManager> mgr =
     do_GetService("@mozilla.org/memory-reporter-manager;1");
 
   // This is the first write to the file, and it causes |aWriter| to allocate
   // over 200 KiB of memory.
   jsonWriter->Start();
   {