Bug 1409598 - Change nsIXPCScriptable::className and nsIClassInfo::{contractID,classDescription} from string to AUTF8String. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 18 Oct 2017 13:17:26 +1100
changeset 387096 c2d3e50e7a8ecc231b8d9c0b9ef1c436a1bb6e2e
parent 387095 4212d0d0ca7762e8821d5912e5f987ffa4c2d595
child 387097 2e368dcaf9888ee6c16a55a532819ca00baa5818
push id32709
push userarchaeopteryx@coole-files.de
push dateThu, 19 Oct 2017 09:27:00 +0000
treeherdermozilla-central@87e3813e7939 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1409598
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1409598 - Change nsIXPCScriptable::className and nsIClassInfo::{contractID,classDescription} from string to AUTF8String. r=froydnj. This lets us replace moz_xstrdup() of string literals with AssignLiteral(), among other improvements.
caps/nsScriptSecurityManager.cpp
dom/base/nsDOMClassInfo.cpp
dom/file/nsHostObjectURI.cpp
js/xpconnect/idl/nsIXPCScriptable.idl
js/xpconnect/public/xpc_map_end.h
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCRuntimeService.cpp
modules/libjar/nsJARURI.cpp
netwerk/base/RustURL.cpp
netwerk/base/nsSimpleURI.cpp
netwerk/base/nsSocketTransport2.cpp
netwerk/base/nsStandardURL.cpp
security/manager/ssl/TransportSecurityInfo.cpp
security/manager/ssl/nsNSSCertificate.cpp
security/manager/ssl/nsSSLStatus.cpp
storage/mozStorageAsyncStatement.cpp
storage/mozStorageStatement.cpp
xpcom/base/nsClassInfoImpl.cpp
xpcom/base/nsISupportsImpl.h
xpcom/components/nsIClassInfo.idl
xpcom/threads/nsThread.cpp
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -160,29 +160,27 @@ inline void SetPendingException(JSContex
 }
 
 // Helper class to get stuff from the ClassInfo and not waste extra time with
 // virtual method calls for things it has already gotten
 class ClassInfoData
 {
 public:
     ClassInfoData(nsIClassInfo *aClassInfo, const char *aName)
-        : mClassInfo(aClassInfo),
-          mFlags(0),
-          mName(const_cast<char *>(aName)),
-          mDidGetFlags(false),
-          mMustFreeName(false)
+      : mClassInfo(aClassInfo),
+        mFlags(0),
+        mName(aName),
+        mDidGetFlags(false)
     {
+      if (!aName) {
+        mName.SetIsVoid(true);
+      }
     }
 
-    ~ClassInfoData()
-    {
-        if (mMustFreeName)
-            free(mName);
-    }
+    ~ClassInfoData() = default;
 
     uint32_t GetFlags()
     {
         if (!mDidGetFlags) {
             if (mClassInfo) {
                 nsresult rv = mClassInfo->GetFlags(&mFlags);
                 if (NS_FAILED(rv)) {
                     mFlags = 0;
@@ -197,39 +195,36 @@ public:
         return mFlags;
     }
 
     bool IsDOMClass()
     {
         return !!(GetFlags() & nsIClassInfo::DOM_OBJECT);
     }
 
-    const char* GetName()
+    void GetName(nsACString& aName)
     {
-        if (!mName) {
+        if (mName.IsVoid()) {
             if (mClassInfo) {
-                mClassInfo->GetClassDescription(&mName);
+                mClassInfo->GetClassDescription(mName);
             }
 
-            if (mName) {
-                mMustFreeName = true;
-            } else {
-                mName = const_cast<char *>("UnnamedClass");
+            if (mName.IsVoid()) {
+                mName.AssignLiteral("UnnamedClass");
             }
         }
 
-        return mName;
+        aName = mName;
     }
 
 private:
     nsIClassInfo *mClassInfo; // WEAK
     uint32_t mFlags;
-    char *mName;
+    nsCString mName;
     bool mDidGetFlags;
-    bool mMustFreeName;
 };
 
 /* static */
 bool
 nsScriptSecurityManager::SecurityCompareURIs(nsIURI* aSourceURI,
                                              nsIURI* aTargetURI)
 {
     return NS_SecurityCompareURIs(aSourceURI, aTargetURI, sStrictFileOriginPolicy);
@@ -1310,32 +1305,34 @@ nsScriptSecurityManager::CanCreateWrappe
 
       nsCOMPtr<nsITreeSelection> treeSelection = do_QueryInterface(aObj);
       if (treeSelection) {
         return NS_OK;
       }
     }
 
     //-- Access denied, report an error
-    nsAutoCString origin;
+    nsAutoCString originUTF8;
     nsIPrincipal* subjectPrincipal = nsContentUtils::SubjectPrincipal();
-    GetPrincipalDomainOrigin(subjectPrincipal, origin);
-    NS_ConvertUTF8toUTF16 originUnicode(origin);
-    NS_ConvertUTF8toUTF16 classInfoName(objClassInfo.GetName());
+    GetPrincipalDomainOrigin(subjectPrincipal, originUTF8);
+    NS_ConvertUTF8toUTF16 originUTF16(originUTF8);
+    nsAutoCString classInfoNameUTF8;
+    objClassInfo.GetName(classInfoNameUTF8);
+    NS_ConvertUTF8toUTF16 classInfoUTF16(classInfoNameUTF8);
     nsresult rv;
     nsAutoString errorMsg;
-    if (originUnicode.IsEmpty()) {
-        const char16_t* formatStrings[] = { classInfoName.get() };
+    if (originUTF16.IsEmpty()) {
+        const char16_t* formatStrings[] = { classInfoUTF16.get() };
         rv = sStrBundle->FormatStringFromName("CreateWrapperDenied",
                                               formatStrings,
                                               1,
                                               errorMsg);
     } else {
-        const char16_t* formatStrings[] = { classInfoName.get(),
-                                            originUnicode.get() };
+        const char16_t* formatStrings[] = { classInfoUTF16.get(),
+                                            originUTF16.get() };
         rv = sStrBundle->FormatStringFromName("CreateWrapperDeniedForOrigin",
                                               formatStrings,
                                               2,
                                               errorMsg);
     }
     NS_ENSURE_SUCCESS(rv, rv);
 
     SetPendingException(cx, errorMsg.get());
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -557,25 +557,24 @@ NS_IMETHODIMP
 nsDOMClassInfo::GetScriptableHelper(nsIXPCScriptable **_retval)
 {
   nsCOMPtr<nsIXPCScriptable> rval = this;
   rval.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMClassInfo::GetContractID(char **aContractID)
+nsDOMClassInfo::GetContractID(nsACString& aContractID)
 {
-  *aContractID = nullptr;
-
+  aContractID.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMClassInfo::GetClassDescription(char **aClassDescription)
+nsDOMClassInfo::GetClassDescription(nsACString& aClassDescription)
 {
   return GetClassName(aClassDescription);
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::GetClassID(nsCID **aClassID)
 {
   *aClassID = nullptr;
@@ -594,20 +593,19 @@ nsDOMClassInfo::GetFlags(uint32_t *aFlag
   *aFlags = DOMCLASSINFO_STANDARD_FLAGS;
 
   return NS_OK;
 }
 
 // nsIXPCScriptable
 
 NS_IMETHODIMP
-nsDOMClassInfo::GetClassName(char **aClassName)
+nsDOMClassInfo::GetClassName(nsACString& aClassName)
 {
-  *aClassName = NS_strdup(mData->mClass.name);
-
+  aClassName.Assign(mData->mClass.name);
   return NS_OK;
 }
 
 // virtual
 uint32_t
 nsDOMClassInfo::GetScriptableFlags()
 {
   return mData->mScriptableFlags;
--- a/dom/file/nsHostObjectURI.cpp
+++ b/dom/file/nsHostObjectURI.cpp
@@ -239,28 +239,28 @@ nsHostObjectURI::GetInterfaces(uint32_t 
 NS_IMETHODIMP
 nsHostObjectURI::GetScriptableHelper(nsIXPCScriptable **_retval)
 {
   *_retval = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHostObjectURI::GetContractID(char * *aContractID)
+nsHostObjectURI::GetContractID(nsACString& aContractID)
 {
   // Make sure to modify any subclasses as needed if this ever
   // changes.
-  *aContractID = nullptr;
+  aContractID.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHostObjectURI::GetClassDescription(char * *aClassDescription)
+nsHostObjectURI::GetClassDescription(nsACString& aClassDescription)
 {
-  *aClassDescription = nullptr;
+  aClassDescription.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHostObjectURI::GetClassID(nsCID * *aClassID)
 {
   // Make sure to modify any subclasses as needed if this ever
   // changes to not call the virtual GetClassIDNoAlloc.
--- a/js/xpconnect/idl/nsIXPCScriptable.idl
+++ b/js/xpconnect/idl/nsIXPCScriptable.idl
@@ -61,17 +61,17 @@ interface nsIXPConnectWrappedNative;
  * Note: This is not really an XPCOM interface.  For example, callers must
  * guarantee that they set the *_retval of the various methods that return a
  * boolean to PR_TRUE before making the call.  Implementations may skip writing
  * to *_retval unless they want to return PR_FALSE.
  */
 [uuid(19b70b26-7c3f-437f-a04a-2a8f9e28b617)]
 interface nsIXPCScriptable : nsISupports
 {
-    readonly attribute string className;
+    readonly attribute AUTF8String className;
     [notxpcom,nostdcall] uint32_t getScriptableFlags();
     [notxpcom,nostdcall] jsClassPtr getClass();
     [notxpcom,nostdcall] JSClassPtr getJSClass();
 
     void   preCreate(in nsISupports nativeObj, in JSContextPtr cx,
                      in JSObjectPtr globalObj, out JSObjectPtr parentObj);
 
     boolean enumerate(in nsIXPConnectWrappedNative wrapper,
--- a/js/xpconnect/public/xpc_map_end.h
+++ b/js/xpconnect/public/xpc_map_end.h
@@ -18,19 +18,19 @@
 #ifndef XPC_MAP_FLAGS
 #error "Must #define XPC_MAP_FLAGS before #including xpc_map_end.h"
 #endif
 
 #include "js/Id.h"
 
 /**************************************************************/
 
-NS_IMETHODIMP XPC_MAP_CLASSNAME::GetClassName(char * *aClassName)
+NS_IMETHODIMP XPC_MAP_CLASSNAME::GetClassName(nsACString& aClassName)
 {
-    *aClassName = moz_xstrdup(XPC_MAP_QUOTED_CLASSNAME);
+    aClassName.AssignLiteral(XPC_MAP_QUOTED_CLASSNAME);
     return NS_OK;
 }
 
 /**************************************************************/
 
 // virtual
 uint32_t
 XPC_MAP_CLASSNAME::GetScriptableFlags()
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -135,26 +135,26 @@ nsXPCComponents_Interfaces::GetInterface
 NS_IMETHODIMP
 nsXPCComponents_Interfaces::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Interfaces::GetContractID(char * *aContractID)
+nsXPCComponents_Interfaces::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Interfaces::GetClassDescription(char * *aClassDescription)
+nsXPCComponents_Interfaces::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCComponents_Interfaces");
+    aClassDescription.AssignLiteral("XPCComponents_Interfaces");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCComponents_Interfaces::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
@@ -339,26 +339,27 @@ nsXPCComponents_InterfacesByID::GetInter
 NS_IMETHODIMP
 nsXPCComponents_InterfacesByID::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetContractID(char * *aContractID)
+nsXPCComponents_InterfacesByID::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetClassDescription(char * *aClassDescription)
+nsXPCComponents_InterfacesByID::GetClassDescription(
+    nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCComponents_InterfacesByID");
+    aClassDescription.AssignLiteral("XPCComponents_InterfacesByID");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCComponents_InterfacesByID::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
@@ -545,26 +546,26 @@ nsXPCComponents_Classes::GetInterfaces(u
 NS_IMETHODIMP
 nsXPCComponents_Classes::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Classes::GetContractID(char * *aContractID)
+nsXPCComponents_Classes::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Classes::GetClassDescription(char * *aClassDescription)
+nsXPCComponents_Classes::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCComponents_Classes");
+    aClassDescription.AssignLiteral("XPCComponents_Classes");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCComponents_Classes::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
@@ -739,26 +740,26 @@ nsXPCComponents_ClassesByID::GetInterfac
 NS_IMETHODIMP
 nsXPCComponents_ClassesByID::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetContractID(char * *aContractID)
+nsXPCComponents_ClassesByID::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetClassDescription(char * *aClassDescription)
+nsXPCComponents_ClassesByID::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCComponents_ClassesByID");
+    aClassDescription.AssignLiteral("XPCComponents_ClassesByID");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCComponents_ClassesByID::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
@@ -948,26 +949,26 @@ nsXPCComponents_Results::GetInterfaces(u
 NS_IMETHODIMP
 nsXPCComponents_Results::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Results::GetContractID(char * *aContractID)
+nsXPCComponents_Results::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Results::GetClassDescription(char * *aClassDescription)
+nsXPCComponents_Results::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCComponents_Results");
+    aClassDescription.AssignLiteral("XPCComponents_Results");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCComponents_Results::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
@@ -1117,26 +1118,26 @@ nsXPCComponents_ID::GetInterfaces(uint32
 NS_IMETHODIMP
 nsXPCComponents_ID::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_ID::GetContractID(char * *aContractID)
+nsXPCComponents_ID::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_ID::GetClassDescription(char * *aClassDescription)
+nsXPCComponents_ID::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCComponents_ID");
+    aClassDescription.AssignLiteral("XPCComponents_ID");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCComponents_ID::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
@@ -1293,26 +1294,26 @@ nsXPCComponents_Exception::GetInterfaces
 NS_IMETHODIMP
 nsXPCComponents_Exception::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Exception::GetContractID(char * *aContractID)
+nsXPCComponents_Exception::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Exception::GetClassDescription(char * *aClassDescription)
+nsXPCComponents_Exception::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCComponents_Exception");
+    aClassDescription.AssignLiteral("XPCComponents_Exception");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCComponents_Exception::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
@@ -1636,26 +1637,26 @@ nsXPCConstructor::GetInterfaces(uint32_t
 NS_IMETHODIMP
 nsXPCConstructor::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCConstructor::GetContractID(char * *aContractID)
+nsXPCConstructor::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCConstructor::GetClassDescription(char * *aClassDescription)
+nsXPCConstructor::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCConstructor");
+    aClassDescription.AssignLiteral("XPCConstructor");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCConstructor::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
@@ -1837,26 +1838,26 @@ nsXPCComponents_Constructor::GetInterfac
 NS_IMETHODIMP
 nsXPCComponents_Constructor::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     *retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Constructor::GetContractID(char * *aContractID)
+nsXPCComponents_Constructor::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-nsXPCComponents_Constructor::GetClassDescription(char * *aClassDescription)
+nsXPCComponents_Constructor::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("XPCComponents_Constructor");
+    aClassDescription.AssignLiteral("XPCComponents_Constructor");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCComponents_Constructor::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
--- a/js/xpconnect/src/XPCRuntimeService.cpp
+++ b/js/xpconnect/src/XPCRuntimeService.cpp
@@ -93,26 +93,26 @@ NS_IMETHODIMP
 BackstagePass::GetScriptableHelper(nsIXPCScriptable** retval)
 {
     nsCOMPtr<nsIXPCScriptable> scriptable = this;
     scriptable.forget(retval);
     return NS_OK;
 }
 
 NS_IMETHODIMP
-BackstagePass::GetContractID(char * *aContractID)
+BackstagePass::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
-BackstagePass::GetClassDescription(char * *aClassDescription)
+BackstagePass::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = moz_xstrdup("BackstagePass");
+    aClassDescription.AssignLiteral("BackstagePass");
     return NS_OK;
 }
 
 NS_IMETHODIMP
 BackstagePass::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
--- a/modules/libjar/nsJARURI.cpp
+++ b/modules/libjar/nsJARURI.cpp
@@ -167,26 +167,26 @@ nsJARURI::GetInterfaces(uint32_t *count,
 NS_IMETHODIMP
 nsJARURI::GetScriptableHelper(nsIXPCScriptable **_retval)
 {
     *_retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsJARURI::GetContractID(char * *aContractID)
+nsJARURI::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsJARURI::GetClassDescription(char * *aClassDescription)
+nsJARURI::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = nullptr;
+    aClassDescription.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsJARURI::GetClassID(nsCID * *aClassID)
 {
     *aClassID = (nsCID*) moz_xmalloc(sizeof(nsCID));
     if (!*aClassID)
--- a/netwerk/base/RustURL.cpp
+++ b/netwerk/base/RustURL.cpp
@@ -676,26 +676,26 @@ RustURL::GetInterfaces(uint32_t *count, 
 NS_IMETHODIMP
 RustURL::GetScriptableHelper(nsIXPCScriptable * *_retval)
 {
   *_retval = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-RustURL::GetContractID(char * *aContractID)
+RustURL::GetContractID(nsACString& aContractID)
 {
-  *aContractID = nullptr;
+  aContractID.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-RustURL::GetClassDescription(char * *aClassDescription)
+RustURL::GetClassDescription(nsACString& aClassDescription)
 {
-  *aClassDescription = nullptr;
+  aClassDescription.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RustURL::GetClassID(nsCID **aClassID)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/netwerk/base/nsSimpleURI.cpp
+++ b/netwerk/base/nsSimpleURI.cpp
@@ -739,28 +739,28 @@ nsSimpleURI::GetInterfaces(uint32_t *cou
 NS_IMETHODIMP
 nsSimpleURI::GetScriptableHelper(nsIXPCScriptable **_retval)
 {
     *_retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSimpleURI::GetContractID(char * *aContractID)
+nsSimpleURI::GetContractID(nsACString& aContractID)
 {
     // Make sure to modify any subclasses as needed if this ever
     // changes.
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSimpleURI::GetClassDescription(char * *aClassDescription)
+nsSimpleURI::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = nullptr;
+    aClassDescription.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSimpleURI::GetClassID(nsCID * *aClassID)
 {
     // Make sure to modify any subclasses as needed if this ever
     // changes to not call the virtual GetClassIDNoAlloc.
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -2966,26 +2966,26 @@ nsSocketTransport::GetInterfaces(uint32_
 NS_IMETHODIMP
 nsSocketTransport::GetScriptableHelper(nsIXPCScriptable **_retval)
 {
     *_retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSocketTransport::GetContractID(char * *aContractID)
+nsSocketTransport::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSocketTransport::GetClassDescription(char * *aClassDescription)
+nsSocketTransport::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = nullptr;
+    aClassDescription.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::GetClassID(nsCID * *aClassID)
 {
     *aClassID = nullptr;
     return NS_OK;
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -3833,26 +3833,26 @@ nsStandardURL::GetInterfaces(uint32_t *c
 NS_IMETHODIMP
 nsStandardURL::GetScriptableHelper(nsIXPCScriptable **_retval)
 {
     *_retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsStandardURL::GetContractID(char * *aContractID)
+nsStandardURL::GetContractID(nsACString& aContractID)
 {
-    *aContractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsStandardURL::GetClassDescription(char * *aClassDescription)
+nsStandardURL::GetClassDescription(nsACString& aClassDescription)
 {
-    *aClassDescription = nullptr;
+    aClassDescription.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStandardURL::GetClassID(nsCID * *aClassID)
 {
     *aClassID = (nsCID*) moz_xmalloc(sizeof(nsCID));
     if (!*aClassID)
--- a/security/manager/ssl/TransportSecurityInfo.cpp
+++ b/security/manager/ssl/TransportSecurityInfo.cpp
@@ -427,26 +427,26 @@ TransportSecurityInfo::GetInterfaces(uin
 NS_IMETHODIMP
 TransportSecurityInfo::GetScriptableHelper(nsIXPCScriptable **_retval)
 {
   *_retval = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TransportSecurityInfo::GetContractID(char * *aContractID)
+TransportSecurityInfo::GetContractID(nsACString& aContractID)
 {
-  *aContractID = nullptr;
+  aContractID.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TransportSecurityInfo::GetClassDescription(char * *aClassDescription)
+TransportSecurityInfo::GetClassDescription(nsACString& aClassDescription)
 {
-  *aClassDescription = nullptr;
+  aClassDescription.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TransportSecurityInfo::GetClassID(nsCID * *aClassID)
 {
   *aClassID = (nsCID*) moz_xmalloc(sizeof(nsCID));
   if (!*aClassID)
--- a/security/manager/ssl/nsNSSCertificate.cpp
+++ b/security/manager/ssl/nsNSSCertificate.cpp
@@ -1533,26 +1533,26 @@ nsNSSCertificate::GetInterfaces(uint32_t
 NS_IMETHODIMP
 nsNSSCertificate::GetScriptableHelper(nsIXPCScriptable** _retval)
 {
   *_retval = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsNSSCertificate::GetContractID(char** aContractID)
+nsNSSCertificate::GetContractID(nsACString& aContractID)
 {
-  *aContractID = nullptr;
+  aContractID.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsNSSCertificate::GetClassDescription(char** aClassDescription)
+nsNSSCertificate::GetClassDescription(nsACString& aClassDescription)
 {
-  *aClassDescription = nullptr;
+  aClassDescription.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNSSCertificate::GetClassID(nsCID** aClassID)
 {
   *aClassID = (nsCID*) moz_xmalloc(sizeof(nsCID));
   if (!*aClassID)
--- a/security/manager/ssl/nsSSLStatus.cpp
+++ b/security/manager/ssl/nsSSLStatus.cpp
@@ -289,26 +289,26 @@ nsSSLStatus::GetInterfaces(uint32_t* aCo
 NS_IMETHODIMP
 nsSSLStatus::GetScriptableHelper(nsIXPCScriptable** aHelper)
 {
   *aHelper = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSSLStatus::GetContractID(char** aContractID)
+nsSSLStatus::GetContractID(nsACString& aContractID)
 {
-  *aContractID = nullptr;
+  aContractID.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSSLStatus::GetClassDescription(char** aClassDescription)
+nsSSLStatus::GetClassDescription(nsACString& aClassDescription)
 {
-  *aClassDescription = nullptr;
+  aClassDescription.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSSLStatus::GetClassID(nsCID** aClassID)
 {
   *aClassID = (nsCID*) moz_xmalloc(sizeof(nsCID));
   if (!*aClassID) {
--- a/storage/mozStorageAsyncStatement.cpp
+++ b/storage/mozStorageAsyncStatement.cpp
@@ -58,26 +58,26 @@ public:
   GetScriptableHelper(nsIXPCScriptable **_helper) override
   {
     static AsyncStatementJSHelper sJSHelper;
     *_helper = &sJSHelper;
     return NS_OK;
   }
 
   NS_IMETHOD
-  GetContractID(char **_contractID) override
+  GetContractID(nsACString& aContractID) override
   {
-    *_contractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_OK;
   }
 
   NS_IMETHOD
-  GetClassDescription(char **_desc) override
+  GetClassDescription(nsACString& aDesc) override
   {
-    *_desc = nullptr;
+    aDesc.SetIsVoid(true);
     return NS_OK;
   }
 
   NS_IMETHOD
   GetClassID(nsCID **_id) override
   {
     *_id = nullptr;
     return NS_OK;
--- a/storage/mozStorageStatement.cpp
+++ b/storage/mozStorageStatement.cpp
@@ -61,26 +61,26 @@ public:
   GetScriptableHelper(nsIXPCScriptable **_helper) override
   {
     static StatementJSHelper sJSHelper;
     *_helper = &sJSHelper;
     return NS_OK;
   }
 
   NS_IMETHOD
-  GetContractID(char **_contractID) override
+  GetContractID(nsACString& aContractID) override
   {
-    *_contractID = nullptr;
+    aContractID.SetIsVoid(true);
     return NS_OK;
   }
 
   NS_IMETHOD
-  GetClassDescription(char **_desc) override
+  GetClassDescription(nsACString& aDesc) override
   {
-    *_desc = nullptr;
+    aDesc.SetIsVoid(true);
     return NS_OK;
   }
 
   NS_IMETHOD
   GetClassID(nsCID **_id) override
   {
     *_id = nullptr;
     return NS_OK;
--- a/xpcom/base/nsClassInfoImpl.cpp
+++ b/xpcom/base/nsClassInfoImpl.cpp
@@ -31,27 +31,27 @@ GenericClassInfo::GetScriptableHelper(ns
 {
   if (mData->getscriptablehelper) {
     return mData->getscriptablehelper(aHelper);
   }
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-GenericClassInfo::GetContractID(char** aContractID)
+GenericClassInfo::GetContractID(nsACString& aContractID)
 {
   NS_ERROR("GetContractID not implemented");
-  *aContractID = nullptr;
+  aContractID.SetIsVoid(true);
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-GenericClassInfo::GetClassDescription(char** aDescription)
+GenericClassInfo::GetClassDescription(nsACString& aDescription)
 {
-  *aDescription = nullptr;
+  aDescription.SetIsVoid(true);
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 GenericClassInfo::GetClassID(nsCID** aClassID)
 {
   NS_ERROR("GetClassID not implemented");
   *aClassID = nullptr;
--- a/xpcom/base/nsISupportsImpl.h
+++ b/xpcom/base/nsISupportsImpl.h
@@ -1201,26 +1201,26 @@ NS_IMETHODIMP                           
 NS_IMETHODIMP                                                                 \
 _class::GetScriptableHelper(nsIXPCScriptable** _retval)                       \
 {                                                                             \
   *_retval = nullptr;                                                         \
   return NS_OK;                                                               \
 }                                                                             \
                                                                               \
 NS_IMETHODIMP                                                                 \
-_class::GetContractID(char** _contractID)                                     \
+_class::GetContractID(nsACString& _contractID)                                \
 {                                                                             \
-  *_contractID = nullptr;                                                     \
+  _contractID.SetIsVoid(true);                                                \
   return NS_OK;                                                               \
 }                                                                             \
                                                                               \
 NS_IMETHODIMP                                                                 \
-_class::GetClassDescription(char** _classDescription)                         \
+_class::GetClassDescription(nsACString& _classDescription)                    \
 {                                                                             \
-  *_classDescription = nullptr;                                               \
+  _classDescription.SetIsVoid(true);                                          \
   return NS_OK;                                                               \
 }                                                                             \
                                                                               \
 NS_IMETHODIMP                                                                 \
 _class::GetClassID(nsCID** _classID)                                          \
 {                                                                             \
   *_classID = nullptr;                                                        \
   return NS_OK;                                                               \
--- a/xpcom/components/nsIClassInfo.idl
+++ b/xpcom/components/nsIClassInfo.idl
@@ -31,24 +31,24 @@ interface nsIClassInfo : nsISupports
     /**
      * Return an object to assist XPConnect in supplying JavaScript-specific
      * behavior to callers of the instance object, or null if not needed.
      */
     nsIXPCScriptable getScriptableHelper();
 
     /**
      * A contract ID through which an instance of this class can be created
-     * (or accessed as a service, if |flags & SINGLETON|), or null.
+     * (or accessed as a service, if |flags & SINGLETON|), or null/void.
      */
-    readonly attribute string   contractID;
+    readonly attribute AUTF8String contractID;
 
     /**
-     * A human readable string naming the class, or null.
+     * A human readable string naming the class, or null/void.
      */
-    readonly attribute string   classDescription;
+    readonly attribute AUTF8String classDescription;
 
     /**
      * A class ID through which an instance of this class can be created
      * (or accessed as a service, if |flags & SINGLETON|), or null.
      */
     readonly attribute nsCIDPtr classID;
 
     /**
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -138,26 +138,26 @@ nsThreadClassInfo::GetInterfaces(uint32_
 NS_IMETHODIMP
 nsThreadClassInfo::GetScriptableHelper(nsIXPCScriptable** aResult)
 {
   *aResult = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsThreadClassInfo::GetContractID(char** aResult)
+nsThreadClassInfo::GetContractID(nsACString& aResult)
 {
-  *aResult = nullptr;
+  aResult.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsThreadClassInfo::GetClassDescription(char** aResult)
+nsThreadClassInfo::GetClassDescription(nsACString& aResult)
 {
-  *aResult = nullptr;
+  aResult.SetIsVoid(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsThreadClassInfo::GetClassID(nsCID** aResult)
 {
   *aResult = nullptr;
   return NS_OK;