Bug 1390428 (part 2, attempt 2) - Remove more nsXPIDLCString local variables. r=erahm.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 21 Aug 2017 20:01:27 +1000
changeset 376077 cc8e481fd0e16fba17ab6786a3f5212ab814c0e9
parent 376076 5caa229b025e4605909de5e28037a3e3796c77be
child 376078 bccc691242c5460e58c6aac1bd3fd63d15037b4a
push id32372
push userarchaeopteryx@coole-files.de
push dateTue, 22 Aug 2017 09:49:24 +0000
treeherdermozilla-central@eb72c8c07751 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1390428
milestone57.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 1390428 (part 2, attempt 2) - Remove more nsXPIDLCString local variables. r=erahm.
dom/base/nsContentUtils.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDocument.cpp
dom/base/nsScriptNameSpaceManager.cpp
dom/plugins/base/nsPluginHost.cpp
dom/push/PushNotifier.cpp
extensions/pref/autoconfig/src/nsReadConfig.cpp
gfx/thebes/gfxSVGGlyphs.cpp
image/SVGDocumentWrapper.cpp
intl/strres/nsStringBundle.cpp
js/xpconnect/src/XPCWrappedNativeInfo.cpp
modules/libpref/nsPrefBranch.cpp
netwerk/protocol/ftp/nsFtpConnectionThread.cpp
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/streamconv/converters/nsIndexedToHTML.cpp
rdf/base/nsInMemoryDataSource.cpp
rdf/base/nsRDFContentSink.cpp
rdf/base/nsRDFService.cpp
toolkit/components/startup/nsUserInfoUnix.cpp
toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
toolkit/xre/nsAppStartupNotifier.cpp
uriloader/base/nsURILoader.cpp
widget/cocoa/nsClipboard.mm
widget/cocoa/nsDragService.mm
widget/gtk/nsClipboard.cpp
widget/gtk/nsColorPicker.cpp
widget/gtk/nsDragService.cpp
widget/gtk/nsFilePicker.cpp
widget/nsHTMLFormatConverter.cpp
widget/nsPrimitiveHelpers.cpp
widget/nsPrimitiveHelpers.h
widget/nsTransferable.cpp
widget/windows/nsClipboard.cpp
widget/windows/nsDataObj.cpp
xpcom/components/nsCategoryManager.cpp
xpfe/components/directory/nsDirectoryViewer.cpp
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7127,22 +7127,22 @@ nsContentUtils::FindInternalContentViewe
 
   // one helper factory, please
   nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
   if (!catMan)
     return nullptr;
 
   nsCOMPtr<nsIDocumentLoaderFactory> docFactory;
 
-  nsXPIDLCString contractID;
+  nsCString contractID;
   nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers",
                                          PromiseFlatCString(aType).get(),
                                          getter_Copies(contractID));
   if (NS_SUCCEEDED(rv)) {
-    docFactory = do_GetService(contractID);
+    docFactory = do_GetService(contractID.get());
     if (docFactory && aLoaderType) {
       if (contractID.EqualsLiteral(CONTENT_DLF_CONTRACTID))
         *aLoaderType = TYPE_CONTENT;
       else if (contractID.EqualsLiteral(PLUGIN_DLF_CONTRACTID))
         *aLoaderType = TYPE_PLUGIN;
       else
       *aLoaderType = TYPE_UNKNOWN;
     }
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -801,19 +801,19 @@ nsDOMClassInfo::PostCreatePrototype(JSCo
       iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
 
     if (iim) {
       nsCOMPtr<nsIInterfaceInfo> if_info;
       iim->GetInfoForIID(mData->mProtoChainInterface,
                          getter_AddRefs(if_info));
 
       if (if_info) {
-        nsXPIDLCString name;
+        nsCString name;
         if_info->GetName(getter_Copies(name));
-        NS_ASSERTION(nsCRT::strcmp(CutPrefix(name), mData->mClass.name) == 0,
+        NS_ASSERTION(nsCRT::strcmp(CutPrefix(name.get()), mData->mClass.name) == 0,
                      "Class name and proto chain interface name mismatch!");
       }
     }
   }
 #endif
 
   // Make prototype delegation work correctly. Consider if a site sets
   // HTMLElement.prototype.foopy = function () { ... } Now, calling
@@ -954,21 +954,21 @@ DefineInterfaceConstants(JSContext *cx, 
   rv = if_info->GetParent(getter_AddRefs(parent_if_info));
   NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && parent_if_info, rv);
 
   uint16_t parent_constant_count, i;
   parent_if_info->GetConstantCount(&parent_constant_count);
 
   JS::Rooted<JS::Value> v(cx);
   for (i = parent_constant_count; i < constant_count; i++) {
-    nsXPIDLCString name;
+    nsCString name;
     rv = if_info->GetConstant(i, &v, getter_Copies(name));
     NS_ENSURE_TRUE(NS_SUCCEEDED(rv), rv);
 
-    if (!::JS_DefineProperty(cx, obj, name, v,
+    if (!::JS_DefineProperty(cx, obj, name.get(), v,
                              JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT,
                              JS_STUBGETTER, JS_STUBSETTER)) {
       return NS_ERROR_UNEXPECTED;
     }
   }
 
   return NS_OK;
 }
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1002,22 +1002,22 @@ nsExternalResourceMap::PendingLoad::Setu
   nsCOMPtr<nsIInterfaceRequestor> newCallbacks =
     new LoadgroupCallbacks(callbacks);
   newLoadGroup->SetNotificationCallbacks(newCallbacks);
 
   // This is some serious hackery cribbed from docshell
   nsCOMPtr<nsICategoryManager> catMan =
     do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
   NS_ENSURE_TRUE(catMan, NS_ERROR_NOT_AVAILABLE);
-  nsXPIDLCString contractId;
+  nsCString contractId;
   nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", type.get(),
                                          getter_Copies(contractId));
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
-    do_GetService(contractId);
+    do_GetService(contractId.get());
   NS_ENSURE_TRUE(docLoaderFactory, NS_ERROR_NOT_AVAILABLE);
 
   nsCOMPtr<nsIContentViewer> viewer;
   nsCOMPtr<nsIStreamListener> listener;
   rv = docLoaderFactory->CreateInstance("external-resource", chan, newLoadGroup,
                                         type, nullptr, nullptr,
                                         getter_AddRefs(listener),
                                         getter_AddRefs(viewer));
--- a/dom/base/nsScriptNameSpaceManager.cpp
+++ b/dom/base/nsScriptNameSpaceManager.cpp
@@ -310,27 +310,27 @@ nsScriptNameSpaceManager::OperateCategor
     if (!s || s->mType != type) {
       return NS_OK;
     }
 
     RemoveFromHash(&entry);
     return NS_OK;
   }
 
-  nsXPIDLCString contractId;
+  nsCString contractId;
   rv = aCategoryManager->GetCategoryEntry(aCategory, categoryEntry.get(),
                                           getter_Copies(contractId));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIComponentRegistrar> registrar;
   rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCID *cidPtr;
-  rv = registrar->ContractIDToCID(contractId, &cidPtr);
+  rv = registrar->ContractIDToCID(contractId.get(), &cidPtr);
 
   if (NS_FAILED(rv)) {
     NS_WARNING("Bad contract id registed with the script namespace manager");
     return NS_OK;
   }
 
   // Copy CID onto the stack, so we can free it right away and avoid having
   // to add cleanup code at every exit point from this function.
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -2703,21 +2703,21 @@ nsPluginHost::RegisterWithCategoryManage
       if (HavePluginForType(aMimeType)) {
         return;
       }
     } else {
       MOZ_ASSERT(aType == ePluginUnregister, "Unknown nsRegisterType");
     }
 
     // Only delete the entry if a plugin registered for it
-    nsXPIDLCString value;
+    nsCString value;
     nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers",
                                            aMimeType.get(),
                                            getter_Copies(value));
-    if (NS_SUCCEEDED(rv) && strcmp(value, contractId) == 0) {
+    if (NS_SUCCEEDED(rv) && strcmp(value.get(), contractId) == 0) {
       catMan->DeleteCategoryEntry("Gecko-Content-Viewers",
                                   aMimeType.get(),
                                   true);
     }
   }
 }
 
 nsresult
--- a/dom/push/PushNotifier.cpp
+++ b/dom/push/PushNotifier.cpp
@@ -308,24 +308,24 @@ PushDispatcher::DoNotifyObservers(nsISup
     mozilla::services::GetObserverService();
   if (!obsService) {
     return NS_ERROR_FAILURE;
   }
   // If there's a service for this push category, make sure it is alive.
   nsCOMPtr<nsICategoryManager> catMan =
     do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
   if (catMan) {
-    nsXPIDLCString contractId;
+    nsCString contractId;
     nsresult rv = catMan->GetCategoryEntry("push",
                                            mScope.BeginReading(),
                                            getter_Copies(contractId));
     if (NS_SUCCEEDED(rv)) {
       // Ensure the service is created - we don't need to do anything with
       // it though - we assume the service constructor attaches a listener.
-      nsCOMPtr<nsISupports> service = do_GetService(contractId);
+      nsCOMPtr<nsISupports> service = do_GetService(contractId.get());
     }
   }
   return obsService->NotifyObservers(aSubject, aTopic,
                                      NS_ConvertUTF8toUTF16(mScope).get());
 }
 
 PushMessageDispatcher::PushMessageDispatcher(const nsACString& aScope,
                                              nsIPrincipal* aPrincipal,
--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp
@@ -111,18 +111,18 @@ NS_IMETHODIMP nsReadConfig::Observe(nsIS
     }
     return rv;
 }
 
 
 nsresult nsReadConfig::readConfigFile()
 {
     nsresult rv = NS_OK;
-    nsXPIDLCString lockFileName;
-    nsXPIDLCString lockVendor;
+    nsCString lockFileName;
+    nsCString lockVendor;
     uint32_t fileNameLen = 0;
 
     nsCOMPtr<nsIPrefBranch> defaultPrefBranch;
     nsCOMPtr<nsIPrefService> prefService =
         do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv))
         return rv;
 
@@ -188,38 +188,38 @@ nsresult nsReadConfig::readConfigFile()
         return NS_ERROR_FAILURE;
 
 
     rv = prefBranch->GetCharPref("general.config.vendor",
                                   getter_Copies(lockVendor));
     // If vendor is not nullptr, do this check
     if (NS_SUCCEEDED(rv)) {
 
-        fileNameLen = strlen(lockFileName);
+        fileNameLen = strlen(lockFileName.get());
 
         // lockVendor and lockFileName should be the same with the addtion of
         // .cfg to the filename by checking this post reading of the cfg file
         // this value can be set within the cfg file adding a level of security.
 
-        if (PL_strncmp(lockFileName, lockVendor, fileNameLen - 4) != 0)
+        if (PL_strncmp(lockFileName.get(), lockVendor.get(), fileNameLen - 4) != 0)
             return NS_ERROR_FAILURE;
     }
 
     // get the value of the autoconfig url
-    nsXPIDLCString urlName;
+    nsCString urlName;
     rv = prefBranch->GetCharPref("autoadmin.global_config_url",
                                   getter_Copies(urlName));
     if (NS_SUCCEEDED(rv) && !urlName.IsEmpty()) {
 
         // Instantiating nsAutoConfig object if the pref is present
         mAutoConfig = do_CreateInstance(NS_AUTOCONFIG_CONTRACTID, &rv);
         if (NS_FAILED(rv))
             return NS_ERROR_OUT_OF_MEMORY;
 
-        rv = mAutoConfig->SetConfigURL(urlName);
+        rv = mAutoConfig->SetConfigURL(urlName.get());
         if (NS_FAILED(rv))
             return NS_ERROR_FAILURE;
 
     }
 
     return NS_OK;
 } // ReadConfigFile
 
--- a/gfx/thebes/gfxSVGGlyphs.cpp
+++ b/gfx/thebes/gfxSVGGlyphs.cpp
@@ -131,21 +131,22 @@ gfxSVGGlyphs::FindOrCreateGlyphsDocument
 
     return result;
 }
 
 nsresult
 gfxSVGGlyphsDocument::SetupPresentation()
 {
     nsCOMPtr<nsICategoryManager> catMan = do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
-    nsXPIDLCString contractId;
+    nsCString contractId;
     nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "image/svg+xml", getter_Copies(contractId));
     NS_ENSURE_SUCCESS(rv, rv);
 
-    nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory = do_GetService(contractId);
+    nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
+      do_GetService(contractId.get());
     NS_ASSERTION(docLoaderFactory, "Couldn't get DocumentLoaderFactory");
 
     nsCOMPtr<nsIContentViewer> viewer;
     rv = docLoaderFactory->CreateInstanceForDocument(nullptr, mDocument, nullptr, getter_AddRefs(viewer));
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = viewer->Init(nullptr, gfx::IntRect(0, 0, 1000, 1000));
     if (NS_SUCCEEDED(rv)) {
--- a/image/SVGDocumentWrapper.cpp
+++ b/image/SVGDocumentWrapper.cpp
@@ -326,22 +326,22 @@ SVGDocumentWrapper::SetupViewer(nsIReque
   nsCOMPtr<nsILoadGroup> newLoadGroup =
         do_CreateInstance(NS_LOADGROUP_CONTRACTID);
   NS_ENSURE_TRUE(newLoadGroup, NS_ERROR_OUT_OF_MEMORY);
   newLoadGroup->SetLoadGroup(loadGroup);
 
   nsCOMPtr<nsICategoryManager> catMan =
     do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
   NS_ENSURE_TRUE(catMan, NS_ERROR_NOT_AVAILABLE);
-  nsXPIDLCString contractId;
+  nsCString contractId;
   nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", IMAGE_SVG_XML,
                                          getter_Copies(contractId));
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
-    do_GetService(contractId);
+    do_GetService(contractId.get());
   NS_ENSURE_TRUE(docLoaderFactory, NS_ERROR_NOT_AVAILABLE);
 
   nsCOMPtr<nsIContentViewer> viewer;
   nsCOMPtr<nsIStreamListener> listener;
   rv = docLoaderFactory->CreateInstance("external-resource", chan,
                                         newLoadGroup,
                                         NS_LITERAL_CSTRING(IMAGE_SVG_XML),
                                         nullptr, nullptr,
--- a/intl/strres/nsStringBundle.cpp
+++ b/intl/strres/nsStringBundle.cpp
@@ -665,17 +665,17 @@ nsStringBundleService::FormatWithBundle(
 NS_IMETHODIMP
 nsStringBundleService::FormatStatusMessage(nsresult aStatus,
                                            const char16_t* aStatusArg,
                                            nsAString& result)
 {
   nsresult rv;
   uint32_t i, argCount = 0;
   nsCOMPtr<nsIStringBundle> bundle;
-  nsXPIDLCString stringBundleURL;
+  nsCString stringBundleURL;
 
   // XXX hack for mailnews who has already formatted their messages:
   if (aStatus == NS_OK && aStatusArg) {
     result.Assign(aStatusArg);
     return NS_OK;
   }
 
   if (aStatus == NS_OK) {
@@ -708,17 +708,17 @@ nsStringBundleService::FormatStatusMessa
       offset = pos + 1;
     }
   }
 
   // find the string bundle for the error's module:
   rv = mErrorService->GetErrorStringBundle(NS_ERROR_GET_MODULE(aStatus),
                                            getter_Copies(stringBundleURL));
   if (NS_SUCCEEDED(rv)) {
-    getStringBundle(stringBundleURL, getter_AddRefs(bundle));
+    getStringBundle(stringBundleURL.get(), getter_AddRefs(bundle));
     rv = FormatWithBundle(bundle, aStatus, argCount, argArray, result);
   }
   if (NS_FAILED(rv)) {
     getStringBundle(GLOBAL_PROPERTIES, getter_AddRefs(bundle));
     rv = FormatWithBundle(bundle, aStatus, argCount, argArray, result);
   }
 
 done:
--- a/js/xpconnect/src/XPCWrappedNativeInfo.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeInfo.cpp
@@ -328,23 +328,23 @@ XPCNativeInterface::NewInstance(nsIInter
             cur->SetIndexInInterface(realTotalCount);
             ++realTotalCount;
         }
     }
 
     if (!failed) {
         for (i = 0; i < constCount; i++) {
             RootedValue constant(cx);
-            nsXPIDLCString namestr;
+            nsCString namestr;
             if (NS_FAILED(aInfo->GetConstant(i, &constant, getter_Copies(namestr)))) {
                 failed = true;
                 break;
             }
 
-            str = JS_AtomizeAndPinString(cx, namestr);
+            str = JS_AtomizeAndPinString(cx, namestr.get());
             if (!str) {
                 NS_ERROR("bad constant name");
                 failed = true;
                 break;
             }
             jsid name = INTERNED_STRING_TO_JSID(cx, str);
 
             // XXX need better way to find dups
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.cpp
@@ -836,28 +836,28 @@ nsPrefBranch::RemoveExpiredCallback(Pref
 nsresult
 nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName,
                                            nsAString& aReturn)
 {
   nsresult rv;
 
   // the default value contains a URL to a .properties file
 
-  nsXPIDLCString propertyFileURL;
+  nsCString propertyFileURL;
   rv = PREF_CopyCharPref(aPrefName, getter_Copies(propertyFileURL), true);
   if (NS_FAILED(rv))
     return rv;
 
   nsCOMPtr<nsIStringBundleService> bundleService =
     mozilla::services::GetStringBundleService();
   if (!bundleService)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIStringBundle> bundle;
-  rv = bundleService->CreateBundle(propertyFileURL,
+  rv = bundleService->CreateBundle(propertyFileURL.get(),
                                    getter_AddRefs(bundle));
   if (NS_FAILED(rv))
     return rv;
 
   return bundle->GetStringFromName(aPrefName, aReturn);
 }
 
 nsPrefBranch::PrefName
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -779,29 +779,29 @@ nsFtpState::S_pass() {
 
     mResponseMsg = "";
 
     if (mAnonymous) {
         if (!mPassword.IsEmpty()) {
             // XXX Is UTF-8 the best choice?
             AppendUTF16toUTF8(mPassword, passwordStr);
         } else {
-            nsXPIDLCString anonPassword;
+            nsCString anonPassword;
             bool useRealEmail = false;
             nsCOMPtr<nsIPrefBranch> prefs =
                     do_GetService(NS_PREFSERVICE_CONTRACTID);
             if (prefs) {
                 rv = prefs->GetBoolPref("advanced.mailftp", &useRealEmail);
                 if (NS_SUCCEEDED(rv) && useRealEmail) {
                     prefs->GetCharPref("network.ftp.anonymous_password",
                                        getter_Copies(anonPassword));
                 }
             }
             if (!anonPassword.IsEmpty()) {
-                passwordStr.AppendASCII(anonPassword);
+                passwordStr.AppendASCII(anonPassword.get());
             } else {
                 // We need to default to a valid email address - bug 101027
                 // example.com is reserved (rfc2606), so use that
                 passwordStr.AppendLiteral("mozilla@example.com");
             }
         }
     } else {
         if (mPassword.IsEmpty() || mRetryPass) {
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -1346,59 +1346,59 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
 
     if (PREF_CHANGED(HTTP_PREF("qos"))) {
         rv = prefs->GetIntPref(HTTP_PREF("qos"), &val);
         if (NS_SUCCEEDED(rv))
             mQoSBits = (uint8_t) clamped(val, 0, 0xff);
     }
 
     if (PREF_CHANGED(HTTP_PREF("accept.default"))) {
-        nsXPIDLCString accept;
+        nsCString accept;
         rv = prefs->GetCharPref(HTTP_PREF("accept.default"),
                                   getter_Copies(accept));
         if (NS_SUCCEEDED(rv)) {
-            rv = SetAccept(accept);
+            rv = SetAccept(accept.get());
             MOZ_ASSERT(NS_SUCCEEDED(rv));
         }
     }
 
     if (PREF_CHANGED(HTTP_PREF("accept-encoding"))) {
-        nsXPIDLCString acceptEncodings;
+        nsCString acceptEncodings;
         rv = prefs->GetCharPref(HTTP_PREF("accept-encoding"),
                                   getter_Copies(acceptEncodings));
         if (NS_SUCCEEDED(rv)) {
-            rv = SetAcceptEncodings(acceptEncodings, false);
+            rv = SetAcceptEncodings(acceptEncodings.get(), false);
             MOZ_ASSERT(NS_SUCCEEDED(rv));
         }
     }
 
     if (PREF_CHANGED(HTTP_PREF("accept-encoding.secure"))) {
-        nsXPIDLCString acceptEncodings;
+        nsCString acceptEncodings;
         rv = prefs->GetCharPref(HTTP_PREF("accept-encoding.secure"),
                                   getter_Copies(acceptEncodings));
         if (NS_SUCCEEDED(rv)) {
-            rv = SetAcceptEncodings(acceptEncodings, true);
+            rv = SetAcceptEncodings(acceptEncodings.get(), true);
             MOZ_ASSERT(NS_SUCCEEDED(rv));
         }
     }
 
     if (PREF_CHANGED(HTTP_PREF("default-socket-type"))) {
-        nsXPIDLCString sval;
+        nsCString sval;
         rv = prefs->GetCharPref(HTTP_PREF("default-socket-type"),
                                 getter_Copies(sval));
         if (NS_SUCCEEDED(rv)) {
             if (sval.IsEmpty())
                 mDefaultSocketType.Adopt(nullptr);
             else {
                 // verify that this socket type is actually valid
                 nsCOMPtr<nsISocketProviderService> sps(
                         do_GetService(NS_SOCKETPROVIDERSERVICE_CONTRACTID));
                 if (sps) {
                     nsCOMPtr<nsISocketProvider> sp;
-                    rv = sps->GetSocketProvider(sval, getter_AddRefs(sp));
+                    rv = sps->GetSocketProvider(sval.get(), getter_AddRefs(sp));
                     if (NS_SUCCEEDED(rv)) {
                         // OK, this looks like a valid socket provider.
                         mDefaultSocketType.Assign(sval);
                     }
                 }
             }
         }
     }
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -675,17 +675,17 @@ nsIndexedToHTML::OnIndexAvailable(nsIReq
     if (!aIndex)
         return NS_ERROR_NULL_POINTER;
 
     nsCString pushBuffer;
     pushBuffer.AppendLiteral("<tr");
 
     // We don't know the file's character set yet, so retrieve the raw bytes
     // which will be decoded by the HTML parser.
-    nsXPIDLCString loc;
+    nsCString loc;
     aIndex->GetLocation(getter_Copies(loc));
 
     // Adjust the length in case unescaping shortened the string.
     loc.Truncate(nsUnescapeCount(loc.BeginWriting()));
 
     if (loc.IsEmpty()) {
         return NS_ERROR_ILLEGAL_VALUE;
     }
--- a/rdf/base/nsInMemoryDataSource.cpp
+++ b/rdf/base/nsInMemoryDataSource.cpp
@@ -785,37 +785,37 @@ InMemoryDataSource::LogOperation(const c
                                  nsIRDFResource* aSource,
                                  nsIRDFResource* aProperty,
                                  nsIRDFNode* aTarget,
                                  bool aTruthValue)
 {
     if (! MOZ_LOG_TEST(gLog, LogLevel::Debug))
         return;
 
-    nsXPIDLCString uri;
+    nsCString uri;
     aSource->GetValue(getter_Copies(uri));
     MOZ_LOG(gLog, LogLevel::Debug,
            ("InMemoryDataSource(%p): %s", this, aOperation));
 
     MOZ_LOG(gLog, LogLevel::Debug,
-           ("  [(%p)%s]--", aSource, (const char*) uri));
+           ("  [(%p)%s]--", aSource, uri.get()));
 
     aProperty->GetValue(getter_Copies(uri));
 
     char tv = (aTruthValue ? '-' : '!');
     MOZ_LOG(gLog, LogLevel::Debug,
-           ("  --%c[(%p)%s]--", tv, aProperty, (const char*) uri));
+           ("  --%c[(%p)%s]--", tv, aProperty, uri.get()));
 
     nsCOMPtr<nsIRDFResource> resource;
     nsCOMPtr<nsIRDFLiteral> literal;
 
     if ((resource = do_QueryInterface(aTarget)) != nullptr) {
         resource->GetValue(getter_Copies(uri));
         MOZ_LOG(gLog, LogLevel::Debug,
-           ("  -->[(%p)%s]", aTarget, (const char*) uri));
+           ("  -->[(%p)%s]", aTarget, uri.get()));
     }
     else if ((literal = do_QueryInterface(aTarget)) != nullptr) {
         nsString value;
         literal->GetValue(getter_Copies(value));
         MOZ_LOG(gLog, LogLevel::Debug,
            ("  -->(\"%s\")\n", NS_ConvertUTF16toUTF8(value).get()));
     }
     else {
--- a/rdf/base/nsRDFContentSink.cpp
+++ b/rdf/base/nsRDFContentSink.cpp
@@ -310,20 +310,20 @@ RDFContentSinkImpl::~RDFContentSinkImpl(
             RDFContentSinkState state;
             RDFContentSinkParseMode parseMode;
             PopContext(resource, state, parseMode);
 
             // print some fairly useless debugging info
             // XXX we should save line numbers on the context stack: this'd
             // be about 1000x more helpful.
             if (resource && MOZ_LOG_TEST(gLog, LogLevel::Debug)) {
-                nsXPIDLCString uri;
+                nsCString uri;
                 resource->GetValue(getter_Copies(uri));
                 MOZ_LOG(gLog, LogLevel::Debug,
-                       ("rdfxml:   uri=%s", (const char*) uri));
+                       ("rdfxml:   uri=%s", uri.get()));
             }
 
             NS_IF_RELEASE(resource);
         }
 
         delete mContextStack;
     }
     free(mText);
--- a/rdf/base/nsRDFService.cpp
+++ b/rdf/base/nsRDFService.cpp
@@ -1172,46 +1172,48 @@ NS_IMETHODIMP
 RDFServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, bool aReplace)
 {
     NS_PRECONDITION(aDataSource != nullptr, "null ptr");
     if (! aDataSource)
         return NS_ERROR_NULL_POINTER;
 
     nsresult rv;
 
-    nsXPIDLCString uri;
+    nsCString uri;
     rv = aDataSource->GetURI(getter_Copies(uri));
     if (NS_FAILED(rv)) return rv;
 
     PLHashEntry** hep =
-        PL_HashTableRawLookup(mNamedDataSources, (*mNamedDataSources->keyHash)(uri), uri);
+      PL_HashTableRawLookup(mNamedDataSources,
+                            (*mNamedDataSources->keyHash)(uri.get()),
+                            uri.get());
 
     if (*hep) {
         if (! aReplace)
             return NS_ERROR_FAILURE; // already registered
 
         // N.B., we only hold a weak reference to the datasource, so
         // just replace the old with the new and don't touch any
         // refcounts.
         MOZ_LOG(gLog, LogLevel::Debug,
                ("rdfserv    replace-datasource [%p] <-- [%p] %s",
-                (*hep)->value, aDataSource, (const char*) uri));
+                (*hep)->value, aDataSource, uri.get()));
 
         (*hep)->value = aDataSource;
     }
     else {
-        const char* key = PL_strdup(uri);
+        const char* key = PL_strdup(uri.get());
         if (! key)
             return NS_ERROR_OUT_OF_MEMORY;
 
         PL_HashTableAdd(mNamedDataSources, key, aDataSource);
 
         MOZ_LOG(gLog, LogLevel::Debug,
                ("rdfserv   register-datasource [%p] %s",
-                aDataSource, (const char*) uri));
+                aDataSource, uri.get()));
 
         // N.B., we only hold a weak reference to the datasource, so don't
         // addref.
     }
 
     return NS_OK;
 }
 
--- a/toolkit/components/startup/nsUserInfoUnix.cpp
+++ b/toolkit/components/startup/nsUserInfoUnix.cpp
@@ -137,29 +137,29 @@ nsUserInfo::GetDomain(char * *aDomain)
 NS_IMETHODIMP
 nsUserInfo::GetEmailAddress(char * *aEmailAddress)
 {
     // use username + "@" + domain for the email address
 
     nsresult rv;
 
     nsAutoCString emailAddress;
-    nsXPIDLCString username;
-    nsXPIDLCString domain;
+    nsCString username;
+    nsCString domain;
 
     rv = GetUsername(getter_Copies(username));
     if (NS_FAILED(rv)) return rv;
 
     rv = GetDomain(getter_Copies(domain));
     if (NS_FAILED(rv)) return rv;
 
     if (!username.IsEmpty() && !domain.IsEmpty()) {
-        emailAddress = (const char *)username;
+        emailAddress = username.get();
         emailAddress += "@";
-        emailAddress += (const char *)domain;
+        emailAddress += domain.get();
     }
     else {
         return NS_ERROR_FAILURE;
     }
 
     *aEmailAddress = ToNewCString(emailAddress);
 
     return NS_OK;
--- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
@@ -326,20 +326,20 @@ nsUrlClassifierUtils::GetTelemetryProvid
 NS_IMETHODIMP
 nsUrlClassifierUtils::GetProtocolVersion(const nsACString& aProvider,
                                          nsACString& aVersion)
 {
   nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefBranch) {
       nsPrintfCString prefName("browser.safebrowsing.provider.%s.pver",
                                nsCString(aProvider).get());
-      nsXPIDLCString version;
+      nsCString version;
       nsresult rv = prefBranch->GetCharPref(prefName.get(), getter_Copies(version));
 
-      aVersion = NS_SUCCEEDED(rv) ? version : DEFAULT_PROTOCOL_VERSION;
+      aVersion = NS_SUCCEEDED(rv) ? version.get() : DEFAULT_PROTOCOL_VERSION;
   } else {
       aVersion = DEFAULT_PROTOCOL_VERSION;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/toolkit/xre/nsAppStartupNotifier.cpp
+++ b/toolkit/xre/nsAppStartupNotifier.cpp
@@ -39,32 +39,32 @@ NS_IMETHODIMP nsAppStartupNotifier::Obse
     nsCOMPtr<nsISupports> entry;
     while (NS_SUCCEEDED(enumerator->GetNext(getter_AddRefs(entry)))) {
         nsCOMPtr<nsISupportsCString> category = do_QueryInterface(entry, &rv);
 
         if (NS_SUCCEEDED(rv)) {
             nsAutoCString categoryEntry;
             rv = category->GetData(categoryEntry);
 
-            nsXPIDLCString contractId;
+            nsCString contractId;
             categoryManager->GetCategoryEntry(aTopic,
                                               categoryEntry.get(),
                                               getter_Copies(contractId));
 
             if (NS_SUCCEEDED(rv)) {
 
                 // If we see the word "service," in the beginning
                 // of the contractId then we create it as a service
                 // if not we do a createInstance
 
                 nsCOMPtr<nsISupports> startupInstance;
                 if (Substring(contractId, 0, 8).EqualsLiteral("service,"))
                     startupInstance = do_GetService(contractId.get() + 8, &rv);
                 else
-                    startupInstance = do_CreateInstance(contractId, &rv);
+                    startupInstance = do_CreateInstance(contractId.get(), &rv);
 
                 if (NS_SUCCEEDED(rv)) {
                     // Try to QI to nsIObserver
                     nsCOMPtr<nsIObserver> startupObserver =
                         do_QueryInterface(startupInstance, &rv);
                     if (NS_SUCCEEDED(rv)) {
                         rv = startupObserver->Observe(nullptr, aTopic, nullptr);
 
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -451,27 +451,27 @@ nsresult nsDocumentOpenInfo::DispatchCon
       //
       // Third step: Try to find a content listener that has not yet had
       // the chance to register, as it is contained in a not-yet-loaded
       // module, but which has registered a contract ID.
       //
       nsCOMPtr<nsICategoryManager> catman =
         do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
       if (catman) {
-        nsXPIDLCString contractidString;
+        nsCString contractidString;
         rv = catman->GetCategoryEntry(NS_CONTENT_LISTENER_CATEGORYMANAGER_ENTRY,
                                       mContentType.get(),
                                       getter_Copies(contractidString));
         if (NS_SUCCEEDED(rv) && !contractidString.IsEmpty()) {
           LOG(("  Listener contractid for '%s' is '%s'",
                mContentType.get(), contractidString.get()));
 
-          listener = do_CreateInstance(contractidString);
+          listener = do_CreateInstance(contractidString.get());
           LOG(("  Listener from category manager: 0x%p", listener.get()));
-          
+
           if (listener && TryContentListener(listener, aChannel)) {
             LOG(("  Listener from category manager likes this type"));
             return NS_OK;
           }
         }
       }
 
       //
--- a/widget/cocoa/nsClipboard.mm
+++ b/widget/cocoa/nsClipboard.mm
@@ -200,17 +200,17 @@ nsClipboard::TransferableFromPasteboard(
   uint32_t flavorCount;
   flavorList->GetLength(&flavorCount);
 
   for (uint32_t i = 0; i < flavorCount; i++) {
     nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryElementAt(flavorList, i);
     if (!currentFlavor)
       continue;
 
-    nsXPIDLCString flavorStr;
+    nsCString flavorStr;
     currentFlavor->ToString(getter_Copies(flavorStr)); // i has a flavr
 
     // printf("looking for clipboard data of type %s\n", flavorStr.get());
 
     NSString *pboardType = nil;
     if (nsClipboard::IsStringType(flavorStr, &pboardType)) {
       NSString* pString = [cocoaPasteboard stringForType:pboardType];
       if (!pString)
@@ -243,17 +243,17 @@ nsClipboard::TransferableFromPasteboard(
            (clipboardDataPtrNoBOM[0] == 0xFFFE))) {
         dataLength -= sizeof(char16_t);
         clipboardDataPtrNoBOM += 1;
       }
 
       nsCOMPtr<nsISupports> genericDataWrapper;
       nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtrNoBOM, dataLength,
                                                  getter_AddRefs(genericDataWrapper));
-      aTransferable->SetTransferData(flavorStr, genericDataWrapper, dataLength);
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, dataLength);
       free(clipboardDataPtr);
       break;
     }
     else if (flavorStr.EqualsLiteral(kCustomTypesMime)) {
       NSString* type =
         [cocoaPasteboard availableTypeFromArray:
           [NSArray arrayWithObject:
             [UTIHelper stringFromPboardType:kMozCustomTypesPboardType]]];
@@ -273,17 +273,17 @@ nsClipboard::TransferableFromPasteboard(
         return NS_ERROR_OUT_OF_MEMORY;
       }
       [pasteboardData getBytes:clipboardDataPtr];
 
       nsCOMPtr<nsISupports> genericDataWrapper;
       nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtr, dataLength,
                                                  getter_AddRefs(genericDataWrapper));
 
-      aTransferable->SetTransferData(flavorStr, genericDataWrapper, dataLength);
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, dataLength);
       free(clipboardDataPtr);
     }
     else if (flavorStr.EqualsLiteral(kJPEGImageMime) ||
              flavorStr.EqualsLiteral(kJPGImageMime) ||
              flavorStr.EqualsLiteral(kPNGImageMime) ||
              flavorStr.EqualsLiteral(kGIFImageMime)) {
       // Figure out if there's data on the pasteboard we can grab (sanity check)
       NSString* type =
@@ -334,17 +334,17 @@ nsClipboard::TransferableFromPasteboard(
       bool successfullyConverted = CGImageDestinationFinalize(dest);
 
       if (successfullyConverted) {
         // Put the converted data in a form Gecko can understand
         nsCOMPtr<nsIInputStream> byteStream;
         NS_NewByteInputStream(getter_AddRefs(byteStream), (const char*)[encodedData bytes],
                                    [encodedData length], NS_ASSIGNMENT_COPY);
   
-        aTransferable->SetTransferData(flavorStr, byteStream, sizeof(nsIInputStream*));
+        aTransferable->SetTransferData(flavorStr.get(), byteStream, sizeof(nsIInputStream*));
       }
 
       if (dest)
         CFRelease(dest);
       if (source)
         CFRelease(source);
       
       if (successfullyConverted)
@@ -391,24 +391,24 @@ nsClipboard::GetNativeClipboardData(nsIT
   if (mCachedClipboard == aWhichClipboard &&
       mChangeCount == [cocoaPasteboard changeCount]) {
     if (mTransferable) {
       for (uint32_t i = 0; i < flavorCount; i++) {
         nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryElementAt(flavorList, i);
         if (!currentFlavor)
           continue;
 
-        nsXPIDLCString flavorStr;
+        nsCString flavorStr;
         currentFlavor->ToString(getter_Copies(flavorStr));
 
         nsCOMPtr<nsISupports> dataSupports;
         uint32_t dataSize = 0;
-        rv = mTransferable->GetTransferData(flavorStr, getter_AddRefs(dataSupports), &dataSize);
+        rv = mTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports), &dataSize);
         if (NS_SUCCEEDED(rv)) {
-          aTransferable->SetTransferData(flavorStr, dataSupports, dataSize);
+          aTransferable->SetTransferData(flavorStr.get(), dataSupports, dataSize);
           return NS_OK; // maybe try to fill in more types? Is there a point?
         }
       }
     }
   } else {
     EmptyClipboard(aWhichClipboard);
   }
 
@@ -529,28 +529,28 @@ nsClipboard::PasteboardDictFromTransfera
 
   uint32_t flavorCount;
   flavorList->GetLength(&flavorCount);
   for (uint32_t i = 0; i < flavorCount; i++) {
     nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryElementAt(flavorList, i);
     if (!currentFlavor)
       continue;
 
-    nsXPIDLCString flavorStr;
+    nsCString flavorStr;
     currentFlavor->ToString(getter_Copies(flavorStr));
 
     MOZ_LOG(sCocoaLog, LogLevel::Info, ("writing out clipboard data of type %s (%d)\n", flavorStr.get(), i));
 
     NSString *pboardType = nil;
 
     if (nsClipboard::IsStringType(flavorStr, &pboardType)) {
       void* data = nullptr;
       uint32_t dataSize = 0;
       nsCOMPtr<nsISupports> genericDataWrapper;
-      rv = aTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper), &dataSize);
+      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericDataWrapper), &dataSize);
       nsPrimitiveHelpers::CreateDataFromPrimitive(flavorStr, genericDataWrapper, &data, dataSize);
 
       NSString* nativeString;
       if (data)
         nativeString = [NSString stringWithCharacters:(const unichar*)data length:(dataSize / sizeof(char16_t))];
       else
         nativeString = [NSString string];
       
@@ -560,33 +560,33 @@ nsClipboard::PasteboardDictFromTransfera
       [pasteboardOutputDict setObject:nativeString forKey:pboardType];
       
       free(data);
     }
     else if (flavorStr.EqualsLiteral(kCustomTypesMime)) {
       void* data = nullptr;
       uint32_t dataSize = 0;
       nsCOMPtr<nsISupports> genericDataWrapper;
-      rv = aTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper), &dataSize);
+      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericDataWrapper), &dataSize);
       nsPrimitiveHelpers::CreateDataFromPrimitive(flavorStr, genericDataWrapper, &data, dataSize);
 
       if (data) {
         NSData* nativeData = [NSData dataWithBytes:data length:dataSize];
         NSString* customType =
           [UTIHelper stringFromPboardType:kMozCustomTypesPboardType];
         [pasteboardOutputDict setObject:nativeData forKey:customType];
         free(data);
       }
     }
     else if (flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
              flavorStr.EqualsLiteral(kJPGImageMime) || flavorStr.EqualsLiteral(kGIFImageMime) ||
              flavorStr.EqualsLiteral(kNativeImageMime)) {
       uint32_t dataSize = 0;
       nsCOMPtr<nsISupports> transferSupports;
-      aTransferable->GetTransferData(flavorStr, getter_AddRefs(transferSupports), &dataSize);
+      aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(transferSupports), &dataSize);
       nsCOMPtr<nsISupportsInterfacePointer> ptrPrimitive(do_QueryInterface(transferSupports));
       if (!ptrPrimitive)
         continue;
 
       nsCOMPtr<nsISupports> primitiveData;
       ptrPrimitive->GetData(getter_AddRefs(primitiveData));
 
       nsCOMPtr<imgIContainer> image(do_QueryInterface(primitiveData));
@@ -631,17 +631,17 @@ nsClipboard::PasteboardDictFromTransfera
       [pasteboardOutputDict setObject:(NSMutableData*)tiffData
                                forKey:tiffType];
       if (tiffData)
         CFRelease(tiffData);
     }
     else if (flavorStr.EqualsLiteral(kFileMime)) {
       uint32_t len = 0;
       nsCOMPtr<nsISupports> genericFile;
-      rv = aTransferable->GetTransferData(flavorStr, getter_AddRefs(genericFile), &len);
+      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericFile), &len);
       if (NS_FAILED(rv)) {
         continue;
       }
 
       nsCOMPtr<nsIFile> file(do_QueryInterface(genericFile));
       if (!file) {
         nsCOMPtr<nsISupportsInterfacePointer> ptr(do_QueryInterface(genericFile));
 
@@ -678,17 +678,17 @@ nsClipboard::PasteboardDictFromTransfera
       [pasteboardOutputDict setObject:[NSArray arrayWithObject:@""]
                                forKey:urlPromise];
       [pasteboardOutputDict setObject:[NSArray arrayWithObject:@""]
                                forKey:urlPromiseContent];
     }
     else if (flavorStr.EqualsLiteral(kURLMime)) {
       uint32_t len = 0;
       nsCOMPtr<nsISupports> genericURL;
-      rv = aTransferable->GetTransferData(flavorStr, getter_AddRefs(genericURL), &len);
+      rv = aTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(genericURL), &len);
       nsCOMPtr<nsISupportsString> urlObject(do_QueryInterface(genericURL));
 
       nsAutoString url;
       urlObject->GetData(url);
 
       NSString* nativeTitle = nil;
 
       // A newline embedded in the URL means that the form is actually URL +
--- a/widget/cocoa/nsDragService.mm
+++ b/widget/cocoa/nsDragService.mm
@@ -391,37 +391,37 @@ nsDragService::GetData(nsITransferable* 
   // when the drag started if possible
   if (mDataItems) {
     nsCOMPtr<nsITransferable> currentTransferable = do_QueryElementAt(mDataItems, aItemIndex);
     if (currentTransferable) {
       for (uint32_t i = 0; i < acceptableFlavorCount; i++) {
         nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryElementAt(flavorList, i);
         if (!currentFlavor)
           continue;
-        nsXPIDLCString flavorStr;
+        nsCString flavorStr;
         currentFlavor->ToString(getter_Copies(flavorStr));
 
         nsCOMPtr<nsISupports> dataSupports;
         uint32_t dataSize = 0;
-        rv = currentTransferable->GetTransferData(flavorStr, getter_AddRefs(dataSupports), &dataSize);
+        rv = currentTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports), &dataSize);
         if (NS_SUCCEEDED(rv)) {
-          aTransferable->SetTransferData(flavorStr, dataSupports, dataSize);
+          aTransferable->SetTransferData(flavorStr.get(), dataSupports, dataSize);
           return NS_OK; // maybe try to fill in more types? Is there a point?
         }
       }
     }
   }
 
   // now check the actual clipboard for data
   for (uint32_t i = 0; i < acceptableFlavorCount; i++) {
     nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryElementAt(flavorList, i);
     if (!currentFlavor)
       continue;
 
-    nsXPIDLCString flavorStr;
+    nsCString flavorStr;
     currentFlavor->ToString(getter_Copies(flavorStr));
 
     MOZ_LOG(sCocoaLog, LogLevel::Info, ("nsDragService::GetData: looking for clipboard data of type %s\n", flavorStr.get()));
 
     NSArray* droppedItems = [globalDragPboard pasteboardItems];
     if (!droppedItems) {
       continue;
     }
@@ -450,17 +450,17 @@ nsDragService::GetData(nsITransferable* 
       clipboardDataPtr[stringLength] = 0; // null terminate
 
       nsCOMPtr<nsIFile> file;
       rv = NS_NewLocalFile(nsDependentString(clipboardDataPtr), true, getter_AddRefs(file));
       free(clipboardDataPtr);
       if (NS_FAILED(rv))
         continue;
 
-      aTransferable->SetTransferData(flavorStr, file, dataLength);
+      aTransferable->SetTransferData(flavorStr.get(), file, dataLength);
       
       break;
     }
     else if (flavorStr.EqualsLiteral(kCustomTypesMime)) {
       NSString* availableType =
         [item availableTypeFromArray:
           [NSArray arrayWithObject:kMozCustomTypesPboardType]];
       if (!availableType || !IsValidType(availableType, false)) {
@@ -477,17 +477,17 @@ nsDragService::GetData(nsITransferable* 
         return NS_ERROR_OUT_OF_MEMORY;
       }
       [pasteboardData getBytes:clipboardDataPtr];
 
       nsCOMPtr<nsISupports> genericDataWrapper;
       nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtr, dataLength,
                                                  getter_AddRefs(genericDataWrapper));
 
-      aTransferable->SetTransferData(flavorStr, genericDataWrapper, sizeof(nsIInputStream*));
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, sizeof(nsIInputStream*));
       free(clipboardDataPtr);
       break;
     }
 
     NSString* pString = nil;
     if (flavorStr.EqualsLiteral(kUnicodeMime)) {
       pString =
         GetStringForType(
@@ -543,17 +543,17 @@ nsDragService::GetData(nsITransferable* 
            (clipboardDataPtrNoBOM[0] == 0xFFFE))) {
         dataLength -= sizeof(char16_t);
         clipboardDataPtrNoBOM += 1;
       }
 
       nsCOMPtr<nsISupports> genericDataWrapper;
       nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtrNoBOM, dataLength,
                                                  getter_AddRefs(genericDataWrapper));
-      aTransferable->SetTransferData(flavorStr, genericDataWrapper, dataLength);
+      aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, dataLength);
       free(clipboardDataPtr);
       break;
     }
 
     // We have never supported this on Mac OS X, we should someday. Normally dragging images
     // in is accomplished with a file path drag instead of the image data itself.
     /*
     if (flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -168,22 +168,22 @@ nsClipboard::SetData(nsITransferable *aT
     // Add all the flavors to this widget's supported type.
     bool imagesAdded = false;
     uint32_t count;
     flavors->GetLength(&count);
     for (uint32_t i=0; i < count; i++) {
         nsCOMPtr<nsISupportsCString> flavor = do_QueryElementAt(flavors, i);
 
         if (flavor) {
-            nsXPIDLCString flavorStr;
+            nsCString flavorStr;
             flavor->ToString(getter_Copies(flavorStr));
 
             // special case text/unicode since we can handle all of
             // the string types
-            if (!strcmp(flavorStr, kUnicodeMime)) {
+            if (flavorStr.EqualsLiteral(kUnicodeMime)) {
                 gtk_target_list_add(list, gdk_atom_intern("UTF8_STRING", FALSE), 0, 0);
                 gtk_target_list_add(list, gdk_atom_intern("COMPOUND_TEXT", FALSE), 0, 0);
                 gtk_target_list_add(list, gdk_atom_intern("TEXT", FALSE), 0, 0);
                 gtk_target_list_add(list, GDK_SELECTION_TYPE_STRING, 0, 0);
                 continue;
             }
 
             if (flavorStr.EqualsLiteral(kNativeImageMime) ||
@@ -196,17 +196,17 @@ nsClipboard::SetData(nsITransferable *aT
                     // accept any writable image type
                     gtk_target_list_add_image_targets(list, 0, TRUE);
                     imagesAdded = true;
                 }
                 continue;
             }
 
             // Add this to our list of valid targets
-            GdkAtom atom = gdk_atom_intern(flavorStr, FALSE);
+            GdkAtom atom = gdk_atom_intern(flavorStr.get(), FALSE);
             gtk_target_list_add(list, atom, 0, 0);
         }
     }
     
     // Get GTK clipboard (CLIPBOARD or PRIMARY)
     GtkClipboard *gtkClipboard = gtk_clipboard_get(GetSelectionAtom(aWhichClipboard));
   
     gint numTargets;
@@ -265,22 +265,22 @@ nsClipboard::GetData(nsITransferable *aT
 
     uint32_t count;
     flavors->GetLength(&count);
     for (uint32_t i=0; i < count; i++) {
         nsCOMPtr<nsISupportsCString> currentFlavor;
         currentFlavor = do_QueryElementAt(flavors, i);
 
         if (currentFlavor) {
-            nsXPIDLCString flavorStr;
+            nsCString flavorStr;
             currentFlavor->ToString(getter_Copies(flavorStr));
 
             // Special case text/unicode since we can convert any
             // string into text/unicode
-            if (!strcmp(flavorStr, kUnicodeMime)) {
+            if (flavorStr.EqualsLiteral(kUnicodeMime)) {
                 gchar* new_text = wait_for_text(clipboard);
                 if (new_text) {
                     // Convert utf-8 into our unicode format.
                     NS_ConvertUTF8toUTF16 ucs2string(new_text);
                     data = (guchar *)ToNewUnicode(ucs2string);
                     length = ucs2string.Length() * 2;
                     g_free(new_text);
                     foundData = true;
@@ -290,51 +290,51 @@ nsClipboard::GetData(nsITransferable *aT
                 // If the type was text/unicode and we couldn't get
                 // text off the clipboard, run the next loop
                 // iteration.
                 continue;
             }
 
             // For images, we must wrap the data in an nsIInputStream then return instead of break,
             // because that code below won't help us.
-            if (!strcmp(flavorStr, kJPEGImageMime) ||
-                !strcmp(flavorStr, kJPGImageMime) ||
-                !strcmp(flavorStr, kPNGImageMime) ||
-                !strcmp(flavorStr, kGIFImageMime)) {
+            if (flavorStr.EqualsLiteral(kJPEGImageMime) ||
+                flavorStr.EqualsLiteral(kJPGImageMime) ||
+                flavorStr.EqualsLiteral(kPNGImageMime) ||
+                flavorStr.EqualsLiteral(kGIFImageMime)) {
                 // Emulate support for image/jpg
-                if (!strcmp(flavorStr, kJPGImageMime)) {
+                if (flavorStr.EqualsLiteral(kJPGImageMime)) {
                     flavorStr.Assign(kJPEGImageMime);
                 }
 
-                GdkAtom atom = gdk_atom_intern(flavorStr, FALSE);
+                GdkAtom atom = gdk_atom_intern(flavorStr.get(), FALSE);
 
                 GtkSelectionData *selectionData = wait_for_contents(clipboard, atom);
                 if (!selectionData)
                     continue;
 
                 nsCOMPtr<nsIInputStream> byteStream;
                 NS_NewByteInputStream(getter_AddRefs(byteStream), 
                                       (const char*)gtk_selection_data_get_data(selectionData),
                                       gtk_selection_data_get_length(selectionData), 
                                       NS_ASSIGNMENT_COPY);
-                aTransferable->SetTransferData(flavorStr, byteStream, sizeof(nsIInputStream*));
+                aTransferable->SetTransferData(flavorStr.get(), byteStream, sizeof(nsIInputStream*));
                 gtk_selection_data_free(selectionData);
                 return NS_OK;
             }
 
             // Get the atom for this type and try to request it off
             // the clipboard.
-            GdkAtom atom = gdk_atom_intern(flavorStr, FALSE);
+            GdkAtom atom = gdk_atom_intern(flavorStr.get(), FALSE);
             GtkSelectionData *selectionData;
             selectionData = wait_for_contents(clipboard, atom);
             if (selectionData) {
                 const guchar *clipboardData = gtk_selection_data_get_data(selectionData);
                 length = gtk_selection_data_get_length(selectionData);
                 // Special case text/html since we can convert into UCS2
-                if (!strcmp(flavorStr, kHTMLMime)) {
+                if (flavorStr.EqualsLiteral(kHTMLMime)) {
                     char16_t* htmlBody= nullptr;
                     int32_t htmlBodyLen = 0;
                     // Convert text/html into our unicode format
                     ConvertHTMLtoUCS2(const_cast<guchar*>(clipboardData), length,
                                       &htmlBody, htmlBodyLen);
                     // Try next data format?
                     if (!htmlBodyLen)
                         continue;
@@ -351,17 +351,17 @@ nsClipboard::GetData(nsITransferable *aT
                 foundFlavor = flavorStr;
                 break;
             }
         }
     }
 
     if (foundData) {
         nsCOMPtr<nsISupports> wrapper;
-        nsPrimitiveHelpers::CreatePrimitiveForData(foundFlavor.get(),
+        nsPrimitiveHelpers::CreatePrimitiveForData(foundFlavor,
                                                    data, length,
                                                    getter_AddRefs(wrapper));
         aTransferable->SetTransferData(foundFlavor.get(),
                                        wrapper, length);
     }
 
     if (data)
         free(data);
@@ -598,18 +598,18 @@ nsClipboard::SelectionGetEvent(GtkClipbo
     rv = trans->GetTransferData(target_name, getter_AddRefs(item), &len);
     // nothing found?
     if (!item || NS_FAILED(rv)) {
         g_free(target_name);
         return;
     }
 
     void *primitive_data = nullptr;
-    nsPrimitiveHelpers::CreateDataFromPrimitive(target_name, item,
-                                                &primitive_data, len);
+    nsPrimitiveHelpers::CreateDataFromPrimitive(nsDependentCString(target_name),
+                                                item, &primitive_data, len);
 
     if (primitive_data) {
         // Check to see if the selection data is text/html
         if (selectionTarget == gdk_atom_intern (kHTMLMime, FALSE)) {
             /*
              * "text/html" can be encoded UCS2. It is recommended that
              * documents transmitted as UCS2 always begin with a ZERO-WIDTH
              * NON-BREAKING SPACE character (hexadecimal FEFF, also called
--- a/widget/gtk/nsColorPicker.cpp
+++ b/widget/gtk/nsColorPicker.cpp
@@ -87,17 +87,17 @@ NS_IMETHODIMP nsColorPicker::Open(nsICol
 
   if (mCallback) {
     // It means Open has already been called: this is not allowed
     NS_WARNING("mCallback is already set. Open called twice?");
     return NS_ERROR_FAILURE;
   }
   mCallback = aColorPickerShownCallback;
 
-  nsXPIDLCString title;
+  nsCString title;
   title.Adopt(ToNewUTF8String(mTitle));
   GtkWindow *parent_window = GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
   
 #if defined(ACTIVATE_GTK3_COLOR_PICKER) && GTK_CHECK_VERSION(3,4,0)
   GtkWidget* color_chooser = gtk_color_chooser_dialog_new(title, parent_window);
     
   if (parent_window) {
       gtk_window_set_destroy_with_parent(GTK_WINDOW(color_chooser), TRUE);
@@ -106,17 +106,17 @@ NS_IMETHODIMP nsColorPicker::Open(nsICol
   gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(color_chooser), FALSE);
   GdkRGBA color_rgba = convertToRgbaColor(color);    
   gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(color_chooser),
                              &color_rgba);
   
   g_signal_connect(GTK_COLOR_CHOOSER(color_chooser), "color-activated",
                    G_CALLBACK(OnColorChanged), this);
 #else
-  GtkWidget *color_chooser = gtk_color_selection_dialog_new(title);
+  GtkWidget *color_chooser = gtk_color_selection_dialog_new(title.get());
   
   if (parent_window) {
     GtkWindow *window = GTK_WINDOW(color_chooser);
     gtk_window_set_transient_for(window, parent_window);
     gtk_window_set_destroy_with_parent(window, TRUE);
   }
 
   GdkColor color_gdk = convertToGdkColor(color);
--- a/widget/gtk/nsDragService.cpp
+++ b/widget/gtk/nsDragService.cpp
@@ -730,41 +730,42 @@ nsDragService::GetData(nsITransferable *
         MOZ_LOG(sDragLm, LogLevel::Debug, ("it's a list..."));
         // find a matching flavor
         for (i = 0; i < cnt; ++i) {
             nsCOMPtr<nsISupportsCString> currentFlavor;
             currentFlavor = do_QueryElementAt(flavorList, i);
             if (!currentFlavor)
                 continue;
 
-            nsXPIDLCString flavorStr;
+            nsCString flavorStr;
             currentFlavor->ToString(getter_Copies(flavorStr));
             MOZ_LOG(sDragLm,
                    LogLevel::Debug,
-                   ("flavor is %s\n", (const char *)flavorStr));
+                   ("flavor is %s\n", flavorStr.get()));
             // get the item with the right index
             nsCOMPtr<nsITransferable> item =
                 do_QueryElementAt(mSourceDataItems, aItemIndex);
             if (!item)
                 continue;
 
             nsCOMPtr<nsISupports> data;
             uint32_t tmpDataLen = 0;
             MOZ_LOG(sDragLm, LogLevel::Debug,
                    ("trying to get transfer data for %s\n",
-                   (const char *)flavorStr));
-            rv = item->GetTransferData(flavorStr,
+                   flavorStr.get()));
+            rv = item->GetTransferData(flavorStr.get(),
                                        getter_AddRefs(data),
                                        &tmpDataLen);
             if (NS_FAILED(rv)) {
                 MOZ_LOG(sDragLm, LogLevel::Debug, ("failed.\n"));
                 continue;
             }
             MOZ_LOG(sDragLm, LogLevel::Debug, ("succeeded.\n"));
-            rv = aTransferable->SetTransferData(flavorStr,data,tmpDataLen);
+            rv = aTransferable->SetTransferData(flavorStr.get(), data,
+                                                tmpDataLen);
             if (NS_FAILED(rv)) {
                 MOZ_LOG(sDragLm,
                        LogLevel::Debug,
                        ("fail to set transfer data into transferable!\n"));
                 continue;
             }
             // ok, we got the data
             return NS_OK;
@@ -776,36 +777,36 @@ nsDragService::GetData(nsITransferable *
     // Now walk down the list of flavors. When we find one that is
     // actually present, copy out the data into the transferable in that
     // format. SetTransferData() implicitly handles conversions.
     for ( i = 0; i < cnt; ++i ) {
         nsCOMPtr<nsISupportsCString> currentFlavor;
         currentFlavor = do_QueryElementAt(flavorList, i);
         if (currentFlavor) {
             // find our gtk flavor
-            nsXPIDLCString flavorStr;
+            nsCString flavorStr;
             currentFlavor->ToString(getter_Copies(flavorStr));
-            GdkAtom gdkFlavor = gdk_atom_intern(flavorStr, FALSE);
+            GdkAtom gdkFlavor = gdk_atom_intern(flavorStr.get(), FALSE);
             MOZ_LOG(sDragLm, LogLevel::Debug,
                    ("looking for data in type %s, gdk flavor %p\n",
-                   static_cast<const char*>(flavorStr), gdkFlavor));
+                   flavorStr.get(), gdkFlavor));
             bool dataFound = false;
             if (gdkFlavor) {
                 GetTargetDragData(gdkFlavor);
             }
             if (mTargetDragData) {
                 MOZ_LOG(sDragLm, LogLevel::Debug, ("dataFound = true\n"));
                 dataFound = true;
             }
             else {
                 MOZ_LOG(sDragLm, LogLevel::Debug, ("dataFound = false\n"));
 
                 // Dragging and dropping from the file manager would cause us 
                 // to parse the source text as a nsIFile URL.
-                if ( strcmp(flavorStr, kFileMime) == 0 ) {
+                if (flavorStr.EqualsLiteral(kFileMime)) {
                     gdkFlavor = gdk_atom_intern(kTextMime, FALSE);
                     GetTargetDragData(gdkFlavor);
                     if (!mTargetDragData) {
                         gdkFlavor = gdk_atom_intern(gTextUriListType, FALSE);
                         GetTargetDragData(gdkFlavor);
                     }
                     if (mTargetDragData) {
                         const char* text = static_cast<char*>(mTargetDragData);
@@ -826,33 +827,33 @@ nsDragService::GetData(nsITransferable *
                                     nsCOMPtr<nsIFile> file;
                                     rv = fileURL->GetFile(getter_AddRefs(file));
                                     if (NS_SUCCEEDED(rv)) {
                                         // The common wrapping code at the end of 
                                         // this function assumes the data is text
                                         // and calls text-specific operations.
                                         // Make a secret hideout here for nsIFile
                                         // objects and return early.
-                                        aTransferable->SetTransferData(flavorStr, file,
+                                        aTransferable->SetTransferData(flavorStr.get(), file,
                                                                        convertedTextLen);
                                         g_free(convertedText);
                                         return NS_OK;
                                     }
                                 }
                             }
                             g_free(convertedText);
                         }
                         continue;
                     }
                 }
 
                 // if we are looking for text/unicode and we fail to find it
                 // on the clipboard first, try again with text/plain. If that
                 // is present, convert it to unicode.
-                if ( strcmp(flavorStr, kUnicodeMime) == 0 ) {
+                if (flavorStr.EqualsLiteral(kUnicodeMime)) {
                     MOZ_LOG(sDragLm, LogLevel::Debug,
                            ("we were looking for text/unicode... \
                            trying with text/plain;charset=utf-8\n"));
                     gdkFlavor = gdk_atom_intern(gTextPlainUTF8Type, FALSE);
                     GetTargetDragData(gdkFlavor);
                     if (mTargetDragData) {
                         MOZ_LOG(sDragLm, LogLevel::Debug, ("Got textplain data\n"));
                         const char* castedText =
@@ -897,17 +898,17 @@ nsDragService::GetData(nsITransferable *
                             } // if plain text data on clipboard
                         } // if plain text flavor present
                     } // if plain text charset=utf-8 flavor present
                 } // if looking for text/unicode
 
                 // if we are looking for text/x-moz-url and we failed to find
                 // it on the clipboard, try again with text/uri-list, and then
                 // _NETSCAPE_URL
-                if (strcmp(flavorStr, kURLMime) == 0) {
+                if (flavorStr.EqualsLiteral(kURLMime)) {
                     MOZ_LOG(sDragLm, LogLevel::Debug,
                            ("we were looking for text/x-moz-url...\
                            trying again with text/uri-list\n"));
                     gdkFlavor = gdk_atom_intern(gTextUriListType, FALSE);
                     GetTargetDragData(gdkFlavor);
                     if (mTargetDragData) {
                         MOZ_LOG(sDragLm, LogLevel::Debug,
                                ("Got text/uri-list data\n"));
@@ -965,31 +966,31 @@ nsDragService::GetData(nsITransferable *
                                    ("failed to get _NETSCAPE_URL data\n"));
                         }
                     }
                 }
 
             } // else we try one last ditch effort to find our data
 
             if (dataFound) {
-                if (strcmp(flavorStr, kCustomTypesMime) != 0) {
+                if (!flavorStr.EqualsLiteral(kCustomTypesMime)) {
                   // the DOM only wants LF, so convert from MacOS line endings
                   // to DOM line endings.
                   nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks(
                                flavorStr,
                                &mTargetDragData,
                                reinterpret_cast<int*>(&mTargetDragDataLen));
                 }
         
                 // put it into the transferable.
                 nsCOMPtr<nsISupports> genericDataWrapper;
                 nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr,
                                     mTargetDragData, mTargetDragDataLen,
                                     getter_AddRefs(genericDataWrapper));
-                aTransferable->SetTransferData(flavorStr,
+                aTransferable->SetTransferData(flavorStr.get(),
                                                genericDataWrapper,
                                                mTargetDragDataLen);
                 // we found one, get out of this loop!
                 MOZ_LOG(sDragLm, LogLevel::Debug, ("dataFound and converted!\n"));
                 break;
             }
         } // if (currentFlavor)
     } // foreach flavor
@@ -1041,22 +1042,22 @@ nsDragService::IsDataFlavorSupported(con
                     uint32_t numFlavors;
                     flavorList->GetLength( &numFlavors );
                     for ( uint32_t flavorIndex = 0;
                           flavorIndex < numFlavors ;
                           ++flavorIndex ) {
                         nsCOMPtr<nsISupportsCString> currentFlavor;
                         currentFlavor = do_QueryElementAt(flavorList, flavorIndex);
                         if (currentFlavor) {
-                            nsXPIDLCString flavorStr;
+                            nsCString flavorStr;
                             currentFlavor->ToString(getter_Copies(flavorStr));
                             MOZ_LOG(sDragLm, LogLevel::Debug,
                                    ("checking %s against %s\n",
-                                   (const char *)flavorStr, aDataFlavor));
-                            if (strcmp(flavorStr, aDataFlavor) == 0) {
+                                   flavorStr.get(), aDataFlavor));
+                            if (flavorStr.Equals(aDataFlavor)) {
                                 MOZ_LOG(sDragLm, LogLevel::Debug,
                                        ("boioioioiooioioioing!\n"));
                                 *_retval = true;
                             }
                         }
                     }
                 }
             }
@@ -1277,23 +1278,23 @@ nsDragService::GetSourceList(void)
                 uint32_t numFlavors;
                 flavorList->GetLength( &numFlavors );
                 for (uint32_t flavorIndex = 0;
                      flavorIndex < numFlavors ;
                      ++flavorIndex ) {
                     nsCOMPtr<nsISupportsCString> currentFlavor;
                     currentFlavor = do_QueryElementAt(flavorList, flavorIndex);
                     if (currentFlavor) {
-                        nsXPIDLCString flavorStr;
+                        nsCString flavorStr;
                         currentFlavor->ToString(getter_Copies(flavorStr));
 
                         // check if text/x-moz-url is supported.
                         // If so, advertise
                         // text/uri-list.
-                        if (strcmp(flavorStr, kURLMime) == 0) {
+                        if (flavorStr.EqualsLiteral(kURLMime)) {
                             listTarget =
                              (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
                             listTarget->target = g_strdup(gTextUriListType);
                             listTarget->flags = 0;
                             MOZ_LOG(sDragLm, LogLevel::Debug,
                                    ("automatically adding target %s\n",
                                     listTarget->target));
                             targetArray.AppendElement(listTarget);
@@ -1312,42 +1313,42 @@ nsDragService::GetSourceList(void)
                 uint32_t numFlavors;
                 flavorList->GetLength( &numFlavors );
                 for (uint32_t flavorIndex = 0;
                      flavorIndex < numFlavors ;
                      ++flavorIndex ) {
                     nsCOMPtr<nsISupportsCString> currentFlavor;
                     currentFlavor = do_QueryElementAt(flavorList, flavorIndex);
                     if (currentFlavor) {
-                        nsXPIDLCString flavorStr;
+                        nsCString flavorStr;
                         currentFlavor->ToString(getter_Copies(flavorStr));
                         GtkTargetEntry *target =
                           (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
-                        target->target = g_strdup(flavorStr);
+                        target->target = g_strdup(flavorStr.get());
                         target->flags = 0;
                         MOZ_LOG(sDragLm, LogLevel::Debug,
                                ("adding target %s\n", target->target));
                         targetArray.AppendElement(target);
 
                         // If there is a file, add the text/uri-list type.
-                        if (strcmp(flavorStr, kFileMime) == 0) {
+                        if (flavorStr.EqualsLiteral(kFileMime)) {
                             GtkTargetEntry *urilistTarget =
                              (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
                             urilistTarget->target = g_strdup(gTextUriListType);
                             urilistTarget->flags = 0;
                             MOZ_LOG(sDragLm, LogLevel::Debug,
                                    ("automatically adding target %s\n",
                                     urilistTarget->target));
                             targetArray.AppendElement(urilistTarget);
                         }
                         // Check to see if this is text/unicode.
                         // If it is, add text/plain
                         // since we automatically support text/plain
                         // if we support text/unicode.
-                        else if (strcmp(flavorStr, kUnicodeMime) == 0) {
+                        else if (flavorStr.EqualsLiteral(kUnicodeMime)) {
                             GtkTargetEntry *plainUTF8Target =
                              (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
                             plainUTF8Target->target = g_strdup(gTextPlainUTF8Type);
                             plainUTF8Target->flags = 0;
                             MOZ_LOG(sDragLm, LogLevel::Debug,
                                    ("automatically adding target %s\n",
                                     plainUTF8Target->target));
                             targetArray.AppendElement(plainUTF8Target);
@@ -1359,17 +1360,17 @@ nsDragService::GetSourceList(void)
                             MOZ_LOG(sDragLm, LogLevel::Debug,
                                    ("automatically adding target %s\n",
                                     plainTarget->target));
                             targetArray.AppendElement(plainTarget);
                         }
                         // Check to see if this is the x-moz-url type.
                         // If it is, add _NETSCAPE_URL
                         // this is a type used by everybody.
-                        else if (strcmp(flavorStr, kURLMime) == 0) {
+                        else if (flavorStr.EqualsLiteral(kURLMime)) {
                             GtkTargetEntry *urlTarget =
                              (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry));
                             urlTarget->target = g_strdup(gMozUrlType);
                             urlTarget->flags = 0;
                             MOZ_LOG(sDragLm, LogLevel::Debug,
                                    ("automatically adding target %s\n",
                                     urlTarget->target));
                             targetArray.AppendElement(urlTarget);
@@ -1492,20 +1493,18 @@ CreateUriList(nsIArray *items, gchar **t
             void    *tmpData = nullptr;
             nsresult rv = NS_OK;
             nsCOMPtr<nsISupports> data;
             rv = item->GetTransferData(kURLMime,
                                        getter_AddRefs(data),
                                        &tmpDataLen);
 
             if (NS_SUCCEEDED(rv)) {
-                nsPrimitiveHelpers::CreateDataFromPrimitive(kURLMime,
-                                                            data,
-                                                            &tmpData,
-                                                            tmpDataLen);
+                nsPrimitiveHelpers::CreateDataFromPrimitive(
+                    nsDependentCString(kURLMime), data, &tmpData, tmpDataLen);
                 char* plainTextData = nullptr;
                 char16_t* castedUnicode = reinterpret_cast<char16_t*>
                                                            (tmpData);
                 uint32_t plainTextLen = 0;
                 UTF16ToNewUTF8(castedUnicode,
                                tmpDataLen / 2,
                                &plainTextData,
                                &plainTextLen);
@@ -1573,71 +1572,71 @@ CreateUriList(nsIArray *items, gchar **t
 void
 nsDragService::SourceDataGet(GtkWidget        *aWidget,
                              GdkDragContext   *aContext,
                              GtkSelectionData *aSelectionData,
                              guint32           aTime)
 {
     MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::SourceDataGet"));
     GdkAtom target = gtk_selection_data_get_target(aSelectionData);
-    nsXPIDLCString mimeFlavor;
+    nsCString mimeFlavor;
     gchar *typeName = 0;
     typeName = gdk_atom_name(target);
     if (!typeName) {
         MOZ_LOG(sDragLm, LogLevel::Debug, ("failed to get atom name.\n"));
         return;
     }
 
     MOZ_LOG(sDragLm, LogLevel::Debug, ("Type is %s\n", typeName));
-    // make a copy since |nsXPIDLCString| won't use |g_free|...
+    // make a copy since |nsCString| won't use |g_free|...
     mimeFlavor.Adopt(strdup(typeName));
     g_free(typeName);
     // check to make sure that we have data items to return.
     if (!mSourceDataItems) {
         MOZ_LOG(sDragLm, LogLevel::Debug, ("Failed to get our data items\n"));
         return;
     }
 
     nsCOMPtr<nsITransferable> item;
     item = do_QueryElementAt(mSourceDataItems, 0);
     if (item) {
         // if someone was asking for text/plain, lookup unicode instead so
         // we can convert it.
         bool needToDoConversionToPlainText = false;
-        const char* actualFlavor = mimeFlavor;
-        if (strcmp(mimeFlavor, kTextMime) == 0 ||
-            strcmp(mimeFlavor, gTextPlainUTF8Type) == 0) {
+        const char* actualFlavor;
+        if (mimeFlavor.EqualsLiteral(kTextMime) ||
+            mimeFlavor.EqualsLiteral(gTextPlainUTF8Type)) {
             actualFlavor = kUnicodeMime;
             needToDoConversionToPlainText = true;
         }
         // if someone was asking for _NETSCAPE_URL we need to convert to
         // plain text but we also need to look for x-moz-url
-        else if (strcmp(mimeFlavor, gMozUrlType) == 0) {
+        else if (mimeFlavor.EqualsLiteral(gMozUrlType)) {
             actualFlavor = kURLMime;
             needToDoConversionToPlainText = true;
         }
         // if someone was asking for text/uri-list we need to convert to
         // plain text.
-        else if (strcmp(mimeFlavor, gTextUriListType) == 0) {
+        else if (mimeFlavor.EqualsLiteral(gTextUriListType)) {
             actualFlavor = gTextUriListType;
             needToDoConversionToPlainText = true;
         }
         else
-            actualFlavor = mimeFlavor;
+            actualFlavor = mimeFlavor.get();
 
         uint32_t tmpDataLen = 0;
         void    *tmpData = nullptr;
         nsresult rv;
         nsCOMPtr<nsISupports> data;
         rv = item->GetTransferData(actualFlavor,
                                    getter_AddRefs(data),
                                    &tmpDataLen);
         if (NS_SUCCEEDED(rv)) {
-            nsPrimitiveHelpers::CreateDataFromPrimitive (actualFlavor, data,
-                                                         &tmpData, tmpDataLen);
+            nsPrimitiveHelpers::CreateDataFromPrimitive(
+                nsDependentCString(actualFlavor), data, &tmpData, tmpDataLen);
             // if required, do the extra work to convert unicode to plain
             // text and replace the output values with the plain text.
             if (needToDoConversionToPlainText) {
                 char* plainTextData = nullptr;
                 char16_t* castedUnicode = reinterpret_cast<char16_t*>
                                                            (tmpData);
                 uint32_t plainTextLen = 0;
                 UTF16ToNewUTF8(castedUnicode,
@@ -1655,17 +1654,17 @@ nsDragService::SourceDataGet(GtkWidget  
                 // this copies the data
                 gtk_selection_data_set(aSelectionData, target,
                                        8,
                                        (guchar *)tmpData, tmpDataLen);
                 // this wasn't allocated with glib
                 free(tmpData);
             }
         } else {
-            if (strcmp(mimeFlavor, gTextUriListType) == 0) {
+            if (mimeFlavor.EqualsLiteral(gTextUriListType)) {
                 // fall back for text/uri-list
                 gchar *uriList;
                 gint length;
                 CreateUriList(mSourceDataItems, &uriList, &length);
                 gtk_selection_data_set(aSelectionData, target,
                                        8, (guchar *)uriList, length);
                 g_free(uriList);
                 return;
--- a/widget/gtk/nsFilePicker.cpp
+++ b/widget/gtk/nsFilePicker.cpp
@@ -371,17 +371,17 @@ nsFilePicker::Show(int16_t *aReturn)
 
 NS_IMETHODIMP
 nsFilePicker::Open(nsIFilePickerShownCallback *aCallback)
 {
   // Can't show two dialogs concurrently with the same filepicker
   if (mRunning)
     return NS_ERROR_NOT_AVAILABLE;
 
-  nsXPIDLCString title;
+  nsCString title;
   title.Adopt(ToNewUTF8String(mTitle));
 
   GtkWindow *parent_widget =
     GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
 
   GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
 
   const gchar* accept_button;
@@ -389,17 +389,17 @@ nsFilePicker::Open(nsIFilePickerShownCal
   if (!mOkButtonLabel.IsEmpty()) {
     accept_button = buttonLabel.get();
   } else {
     accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE) ?
                     GTK_STOCK_SAVE : GTK_STOCK_OPEN;
   }
 
   GtkWidget *file_chooser =
-      gtk_file_chooser_dialog_new(title, parent_widget, action,
+      gtk_file_chooser_dialog_new(title.get(), parent_widget, action,
                                   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                   accept_button, GTK_RESPONSE_ACCEPT,
                                   nullptr);
   gtk_dialog_set_alternative_button_order(GTK_DIALOG(file_chooser),
                                           GTK_RESPONSE_ACCEPT,
                                           GTK_RESPONSE_CANCEL,
                                           -1);
   if (mAllowURLs) {
--- a/widget/nsHTMLFormatConverter.cpp
+++ b/widget/nsHTMLFormatConverter.cpp
@@ -176,35 +176,35 @@ nsHTMLFormatConverter::Convert(const cha
     nsAutoString dataStr;
     dataWrapper0->GetData ( dataStr );  // COPY #1
     // note: conversion to text/plain is done inside the clipboard. we do not need to worry
     // about it here.
     if ( toFlavor.Equals(kHTMLMime) || toFlavor.Equals(kUnicodeMime) ) {
       nsresult res;
       if (toFlavor.Equals(kHTMLMime)) {
         int32_t dataLen = dataStr.Length() * 2;
-        nsPrimitiveHelpers::CreatePrimitiveForData ( toFlavor.get(), dataStr.get(), dataLen, aToData );
+        nsPrimitiveHelpers::CreatePrimitiveForData ( toFlavor, dataStr.get(), dataLen, aToData );
         if ( *aToData )
           *aDataToLen = dataLen;
       } else {
         nsAutoString outStr;
         res = ConvertFromHTMLToUnicode(dataStr, outStr);
         if (NS_SUCCEEDED(res)) {
           int32_t dataLen = outStr.Length() * 2;
-          nsPrimitiveHelpers::CreatePrimitiveForData ( toFlavor.get(), outStr.get(), dataLen, aToData );
+          nsPrimitiveHelpers::CreatePrimitiveForData ( toFlavor, outStr.get(), dataLen, aToData );
           if ( *aToData )
             *aDataToLen = dataLen;
         }
       }
     } // else if HTML or Unicode
     else if ( toFlavor.Equals(kAOLMailMime) ) {
       nsAutoString outStr;
       if ( NS_SUCCEEDED(ConvertFromHTMLToAOLMail(dataStr, outStr)) ) {
         int32_t dataLen = outStr.Length() * 2;
-        nsPrimitiveHelpers::CreatePrimitiveForData ( toFlavor.get(), outStr.get(), dataLen, aToData );
+        nsPrimitiveHelpers::CreatePrimitiveForData ( toFlavor, outStr.get(), dataLen, aToData );
         if ( *aToData )
           *aDataToLen = dataLen;
       }
     } // else if AOL mail
     else {
       rv = NS_ERROR_FAILURE;
     }
   } // if we got html mime
--- a/widget/nsPrimitiveHelpers.cpp
+++ b/widget/nsPrimitiveHelpers.cpp
@@ -36,24 +36,26 @@
 // CreatePrimitiveForData
 //
 // Given some data and the flavor it corresponds to, creates the appropriate
 // nsISupports* wrapper for passing across IDL boundaries. Right now, everything
 // creates a two-byte |nsISupportsString|, except for "text/plain" and native
 // platform HTML (CF_HTML on win32)
 //
 void
-nsPrimitiveHelpers :: CreatePrimitiveForData ( const char* aFlavor, const void* aDataBuff,
+nsPrimitiveHelpers :: CreatePrimitiveForData ( const nsACString& aFlavor, const void* aDataBuff,
                                                  uint32_t aDataLen, nsISupports** aPrimitive )
 {
   if ( !aPrimitive )
     return;
 
-  if ( strcmp(aFlavor,kTextMime) == 0 || strcmp(aFlavor,kNativeHTMLMime) == 0 ||
-       strcmp(aFlavor,kRTFMime) == 0 || strcmp(aFlavor,kCustomTypesMime) == 0) {
+  if ( aFlavor.EqualsLiteral(kTextMime) ||
+       aFlavor.EqualsLiteral(kNativeHTMLMime) ||
+       aFlavor.EqualsLiteral(kRTFMime) ||
+       aFlavor.EqualsLiteral(kCustomTypesMime)) {
     nsCOMPtr<nsISupportsCString> primitive =
         do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID);
     if ( primitive ) {
       const char * start = reinterpret_cast<const char*>(aDataBuff);
       primitive->SetData(Substring(start, start + aDataLen));
       NS_ADDREF(*aPrimitive = primitive);
     }
   }
@@ -101,17 +103,17 @@ nsPrimitiveHelpers :: CreatePrimitiveFor
 
   // We need to duplicate the input buffer, since the removal of linebreaks
   // might reallocte it.
   void* utf8 = moz_xmalloc(*aDataLen);
   if (!utf8)
     return;
   memcpy(utf8, aDataBuff, *aDataLen);
   int32_t signedLen = static_cast<int32_t>(*aDataLen);
-  nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks(kTextMime, &utf8, &signedLen);
+  nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks(nsDependentCString(kTextMime), &utf8, &signedLen);
   *aDataLen = signedLen;
 
   nsAutoString str(NS_ConvertUTF8toUTF16(reinterpret_cast<const char*>(utf8), *aDataLen));
   free(utf8);
   *aDataLen = str.Length() * sizeof(char16_t);
   primitive->SetData(str);
   NS_ADDREF(*aPrimitive = primitive);
 }
@@ -120,25 +122,26 @@ nsPrimitiveHelpers :: CreatePrimitiveFor
 //
 // CreateDataFromPrimitive
 //
 // Given a nsISupports* primitive and the flavor it represents, creates a new data
 // buffer with the data in it. This data will be null terminated, but the length
 // parameter does not reflect that.
 //
 void
-nsPrimitiveHelpers :: CreateDataFromPrimitive ( const char* aFlavor, nsISupports* aPrimitive,
+nsPrimitiveHelpers :: CreateDataFromPrimitive ( const nsACString& aFlavor, nsISupports* aPrimitive,
                                                    void** aDataBuff, uint32_t aDataLen )
 {
   if ( !aDataBuff )
     return;
 
   *aDataBuff = nullptr;
 
-  if ( strcmp(aFlavor,kTextMime) == 0 || strcmp(aFlavor,kCustomTypesMime) == 0) {
+  if (aFlavor.EqualsLiteral(kTextMime) ||
+      aFlavor.EqualsLiteral(kCustomTypesMime)) {
     nsCOMPtr<nsISupportsCString> plainText ( do_QueryInterface(aPrimitive) );
     if ( plainText ) {
       nsAutoCString data;
       plainText->GetData ( data );
       *aDataBuff = ToNewCString(data);
     }
   }
   else {
@@ -159,38 +162,39 @@ nsPrimitiveHelpers :: CreateDataFromPrim
 // Given some data, convert from the platform linebreaks into the LF expected by the
 // DOM. This will attempt to convert the data in place, but the buffer may still need to
 // be reallocated regardless (disposing the old buffer is taken care of internally, see
 // the note below).
 //
 // NOTE: this assumes that it can use 'free' to dispose of the old buffer.
 //
 nsresult
-nsLinebreakHelpers :: ConvertPlatformToDOMLinebreaks ( const char* inFlavor, void** ioData,
+nsLinebreakHelpers :: ConvertPlatformToDOMLinebreaks ( const nsACString& inFlavor, void** ioData,
                                                           int32_t* ioLengthInBytes )
 {
   NS_ASSERTION ( ioData && *ioData && ioLengthInBytes, "Bad Params");
   if ( !(ioData && *ioData && ioLengthInBytes) )
     return NS_ERROR_INVALID_ARG;
 
   nsresult retVal = NS_OK;
 
-  if ( strcmp(inFlavor, kTextMime) == 0 || strcmp(inFlavor, kRTFMime) == 0) {
+  if (inFlavor.EqualsLiteral(kTextMime) ||
+      inFlavor.EqualsLiteral(kRTFMime)) {
     char* buffAsChars = reinterpret_cast<char*>(*ioData);
     char* oldBuffer = buffAsChars;
     retVal = nsLinebreakConverter::ConvertLineBreaksInSitu ( &buffAsChars, nsLinebreakConverter::eLinebreakAny,
                                                               nsLinebreakConverter::eLinebreakContent,
                                                               *ioLengthInBytes, ioLengthInBytes );
     if ( NS_SUCCEEDED(retVal) ) {
       if ( buffAsChars != oldBuffer )             // check if buffer was reallocated
         free ( oldBuffer );
       *ioData = buffAsChars;
     }
   }
-  else if ( strcmp(inFlavor, "image/jpeg") == 0 ) {
+  else if (inFlavor.EqualsLiteral("image/jpeg")) {
     // I'd assume we don't want to do anything for binary data....
   }
   else {
     char16_t* buffAsUnichar = reinterpret_cast<char16_t*>(*ioData);
     char16_t* oldBuffer = buffAsUnichar;
     int32_t newLengthInChars;
     retVal = nsLinebreakConverter::ConvertUnicharLineBreaksInSitu ( &buffAsUnichar, nsLinebreakConverter::eLinebreakAny,
                                                                      nsLinebreakConverter::eLinebreakContent,
--- a/widget/nsPrimitiveHelpers.h
+++ b/widget/nsPrimitiveHelpers.h
@@ -15,41 +15,41 @@ class nsISupports;
 
 class nsPrimitiveHelpers
 {
 public:
 
     // Given some data and the flavor it corresponds to, creates the appropriate
     // nsISupports* wrapper for passing across IDL boundaries. The length parameter
     // should not include the null if the data is null terminated.
-  static void CreatePrimitiveForData ( const char* aFlavor, const void* aDataBuff,
+  static void CreatePrimitiveForData ( const nsACString& aFlavor, const void* aDataBuff,
                                          uint32_t aDataLen, nsISupports** aPrimitive ) ;
 
     // A specific case of CreatePrimitive for windows CF_HTML handling in DataTransfer
   static void CreatePrimitiveForCFHTML ( const void* aDataBuff,
                                          uint32_t* aDataLen, nsISupports** aPrimitive ) ;
 
     // Given a nsISupports* primitive and the flavor it represents, creates a new data
     // buffer with the data in it. This data will be null terminated, but the length
     // parameter does not reflect that.
-  static void CreateDataFromPrimitive ( const char* aFlavor, nsISupports* aPrimitive, 
+  static void CreateDataFromPrimitive ( const nsACString& aFlavor, nsISupports* aPrimitive, 
                                          void** aDataBuff, uint32_t aDataLen ) ;
 
 }; // class nsPrimitiveHelpers
 
 
 
 class nsLinebreakHelpers
 {
 public:
 
     // Given some data, convert from the platform linebreaks into the LF expected by the
     // DOM. This will attempt to convert the data in place, but the buffer may still need to
     // be reallocated regardless (disposing the old buffer is taken care of internally, see
     // the note below).
     //
     // NOTE: this assumes that it can use 'free' to dispose of the old buffer.
-  static nsresult ConvertPlatformToDOMLinebreaks ( const char* inFlavor, void** ioData, int32_t* ioLengthInBytes ) ;
+  static nsresult ConvertPlatformToDOMLinebreaks ( const nsACString& inFlavor, void** ioData, int32_t* ioLengthInBytes ) ;
 
 }; // class nsLinebreakHelpers
 
 
 #endif // nsPrimitiveHelpers_h___
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -134,33 +134,33 @@ DataStruct::GetFileSpec(const char* aFil
 nsresult
 DataStruct::WriteCache(nsISupports* aData, uint32_t aDataLen)
 {
   // Get a new path and file to the temp directory
   nsCOMPtr<nsIFile> cacheFile = GetFileSpec(mCacheFileName);
   if (cacheFile) {
     // remember the file name
     if (!mCacheFileName) {
-      nsXPIDLCString fName;
+      nsCString fName;
       cacheFile->GetNativeLeafName(fName);
-      mCacheFileName = strdup(fName);
+      mCacheFileName = strdup(fName.get());
     }
 
     // write out the contents of the clipboard
     // to the file
     //uint32_t bytes;
     nsCOMPtr<nsIOutputStream> outStr;
 
     NS_NewLocalFileOutputStream(getter_AddRefs(outStr),
                                 cacheFile);
 
     if (!outStr) return NS_ERROR_FAILURE;
 
     void* buff = nullptr;
-    nsPrimitiveHelpers::CreateDataFromPrimitive ( mFlavor.get(), aData, &buff, aDataLen );
+    nsPrimitiveHelpers::CreateDataFromPrimitive ( mFlavor, aData, &buff, aDataLen );
     if ( buff ) {
       uint32_t ignored;
       outStr->Write(reinterpret_cast<char*>(buff), aDataLen, &ignored);
       free(buff);
       return NS_OK;
     }
   }
   return NS_ERROR_FAILURE;
@@ -198,17 +198,17 @@ DataStruct::ReadCache(nsISupports** aDat
                                 cacheFile);
 
     if (!cacheFile) return NS_ERROR_FAILURE;
 
     nsresult rv = inStr->Read(data.get(), fileSize, aDataLen);
 
     // make sure we got all the data ok
     if (NS_SUCCEEDED(rv) && *aDataLen == size) {
-      nsPrimitiveHelpers::CreatePrimitiveForData(mFlavor.get(), data.get(),
+      nsPrimitiveHelpers::CreatePrimitiveForData(mFlavor, data.get(),
                                                  fileSize, aData);
       return *aData ? NS_OK : NS_ERROR_FAILURE;
     }
 
     // zero the return params
     *aData    = nullptr;
     *aDataLen = 0;
   }
--- a/widget/windows/nsClipboard.cpp
+++ b/widget/windows/nsClipboard.cpp
@@ -170,74 +170,76 @@ nsresult nsClipboard::SetupNativeDataObj
   // Walk through flavors that contain data and register them
   // into the DataObj as supported flavors
   uint32_t i;
   uint32_t cnt;
   dfList->GetLength(&cnt);
   for (i=0;i<cnt;i++) {
     nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryElementAt(dfList, i);
     if ( currentFlavor ) {
-      nsXPIDLCString flavorStr;
+      nsCString flavorStr;
       currentFlavor->ToString(getter_Copies(flavorStr));
       // When putting data onto the clipboard, we want to maintain kHTMLMime
       // ("text/html") and not map it to CF_HTML here since this will be done below.
-      UINT format = GetFormat(flavorStr, false);
+      UINT format = GetFormat(flavorStr.get(), false);
 
       // Now tell the native IDataObject about both our mime type and 
       // the native data format
       FORMATETC fe;
       SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL);
-      dObj->AddDataFlavor(flavorStr, &fe);
+      dObj->AddDataFlavor(flavorStr.get(), &fe);
       
       // Do various things internal to the implementation, like map one
       // flavor to another or add additional flavors based on what's required
       // for the win32 impl.
-      if ( strcmp(flavorStr, kUnicodeMime) == 0 ) {
+      if (flavorStr.EqualsLiteral(kUnicodeMime)) {
         // if we find text/unicode, also advertise text/plain (which we will convert
         // on our own in nsDataObj::GetText().
         FORMATETC textFE;
         SET_FORMATETC(textFE, CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL);
         dObj->AddDataFlavor(kTextMime, &textFE);
       }
-      else if ( strcmp(flavorStr, kHTMLMime) == 0 ) {      
+      else if (flavorStr.EqualsLiteral(kHTMLMime)) {
         // if we find text/html, also advertise win32's html flavor (which we will convert
         // on our own in nsDataObj::GetText().
         FORMATETC htmlFE;
         SET_FORMATETC(htmlFE, CF_HTML, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL);
         dObj->AddDataFlavor(kHTMLMime, &htmlFE);     
       }
-      else if ( strcmp(flavorStr, kURLMime) == 0 ) {
+      else if (flavorStr.EqualsLiteral(kURLMime)) {
         // if we're a url, in addition to also being text, we need to register
         // the "file" flavors so that the win32 shell knows to create an internet
         // shortcut when it sees one of these beasts.
         FORMATETC shortcutFE;
         SET_FORMATETC(shortcutFE, ::RegisterClipboardFormat(CFSTR_FILEDESCRIPTORA), 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
         dObj->AddDataFlavor(kURLMime, &shortcutFE);      
         SET_FORMATETC(shortcutFE, ::RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW), 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
         dObj->AddDataFlavor(kURLMime, &shortcutFE);      
         SET_FORMATETC(shortcutFE, ::RegisterClipboardFormat(CFSTR_FILECONTENTS), 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
         dObj->AddDataFlavor(kURLMime, &shortcutFE);  
         SET_FORMATETC(shortcutFE, ::RegisterClipboardFormat(CFSTR_INETURLA), 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
         dObj->AddDataFlavor(kURLMime, &shortcutFE);      
         SET_FORMATETC(shortcutFE, ::RegisterClipboardFormat(CFSTR_INETURLW), 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
         dObj->AddDataFlavor(kURLMime, &shortcutFE);      
       }
-      else if ( strcmp(flavorStr, kPNGImageMime) == 0 || strcmp(flavorStr, kJPEGImageMime) == 0 ||
-                strcmp(flavorStr, kJPGImageMime) == 0 || strcmp(flavorStr, kGIFImageMime) == 0 ||
-                strcmp(flavorStr, kNativeImageMime) == 0  ) {
+      else if (flavorStr.EqualsLiteral(kPNGImageMime) ||
+               flavorStr.EqualsLiteral(kJPEGImageMime) ||
+               flavorStr.EqualsLiteral(kJPGImageMime) ||
+               flavorStr.EqualsLiteral(kGIFImageMime) ||
+               flavorStr.EqualsLiteral(kNativeImageMime)) {
         // if we're an image, register the native bitmap flavor
         FORMATETC imageFE;
         // Add DIBv5
         SET_FORMATETC(imageFE, CF_DIBV5, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
-        dObj->AddDataFlavor(flavorStr, &imageFE);
+        dObj->AddDataFlavor(flavorStr.get(), &imageFE);
         // Add DIBv3 
         SET_FORMATETC(imageFE, CF_DIB, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL)
-        dObj->AddDataFlavor(flavorStr, &imageFE);
+        dObj->AddDataFlavor(flavorStr.get(), &imageFE);
       }
-      else if ( strcmp(flavorStr, kFilePromiseMime) == 0 ) {
+      else if (flavorStr.EqualsLiteral(kFilePromiseMime)) {
          // if we're a file promise flavor, also register the 
          // CFSTR_PREFERREDDROPEFFECT format.  The data object
          // returns a value of DROPEFFECTS_MOVE to the drop target
          // when it asks for the value of this format.  This causes
          // the file to be moved from the temporary location instead
          // of being copied.  The right thing to do here is to call
          // SetData() on the data object and set the value of this format
          // to DROPEFFECTS_MOVE on this particular data object.  But,
@@ -608,127 +610,127 @@ nsresult nsClipboard::GetDataFromDataObj
 
   // Walk through flavors and see which flavor is on the clipboard them on the native clipboard,
   uint32_t i;
   uint32_t cnt;
   flavorList->GetLength(&cnt);
   for (i=0;i<cnt;i++) {
     nsCOMPtr<nsISupportsCString> currentFlavor = do_QueryElementAt(flavorList, i);
     if ( currentFlavor ) {
-      nsXPIDLCString flavorStr;
+      nsCString flavorStr;
       currentFlavor->ToString(getter_Copies(flavorStr));
-      UINT format = GetFormat(flavorStr);
+      UINT format = GetFormat(flavorStr.get());
 
       // Try to get the data using the desired flavor. This might fail, but all is
       // not lost.
       void* data = nullptr;
       uint32_t dataLen = 0;
       bool dataFound = false;
       if (nullptr != aDataObject) {
-        if (NS_SUCCEEDED(GetNativeDataOffClipboard(aDataObject, anIndex, format, flavorStr, &data, &dataLen))) {
+        if (NS_SUCCEEDED(GetNativeDataOffClipboard(aDataObject, anIndex, format, flavorStr.get(), &data, &dataLen))) {
           dataFound = true;
         }
       } 
       else if (nullptr != aWindow) {
         if (NS_SUCCEEDED(GetNativeDataOffClipboard(aWindow, anIndex, format, &data, &dataLen))) {
           dataFound = true;
         }
       }
 
       // This is our second chance to try to find some data, having not found it
       // when directly asking for the flavor. Let's try digging around in other
       // flavors to help satisfy our craving for data.
       if ( !dataFound ) {
-        if (strcmp(flavorStr, kUnicodeMime) == 0) {
+        if (flavorStr.EqualsLiteral(kUnicodeMime)) {
           dataFound = FindUnicodeFromPlainText(aDataObject, anIndex, &data, &dataLen);
         }
-        else if ( strcmp(flavorStr, kURLMime) == 0 ) {
+        else if (flavorStr.EqualsLiteral(kURLMime)) {
           // drags from other windows apps expose the native
           // CFSTR_INETURL{A,W} flavor
           dataFound = FindURLFromNativeURL ( aDataObject, anIndex, &data, &dataLen );
           if (!dataFound) {
             dataFound = FindURLFromLocalFile(aDataObject, anIndex, &data, &dataLen);
           }
         }
       } // if we try one last ditch effort to find our data
 
       // Hopefully by this point we've found it and can go about our business
       if ( dataFound ) {
         nsCOMPtr<nsISupports> genericDataWrapper;
-          if ( strcmp(flavorStr, kFileMime) == 0 ) {
+          if (flavorStr.EqualsLiteral(kFileMime)) {
             // we have a file path in |data|. Create an nsLocalFile object.
             nsDependentString filepath(reinterpret_cast<char16_t*>(data));
             nsCOMPtr<nsIFile> file;
             if (NS_SUCCEEDED(NS_NewLocalFile(filepath, false, getter_AddRefs(file)))) {
               genericDataWrapper = do_QueryInterface(file);
             }
             free(data);
           }
-        else if ( strcmp(flavorStr, kNativeHTMLMime) == 0 ) {
+        else if (flavorStr.EqualsLiteral(kNativeHTMLMime)) {
           uint32_t dummy;
           // the editor folks want CF_HTML exactly as it's on the clipboard, no conversions,
           // no fancy stuff. Pull it off the clipboard, stuff it into a wrapper and hand
           // it back to them.
           if (FindPlatformHTML(aDataObject, anIndex, &data, &dummy, &dataLen)) {
             nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, data, dataLen, getter_AddRefs(genericDataWrapper));
           }
           else
           {
             free(data);
             continue;     // something wrong with this flavor, keep looking for other data
           }
           free(data);
         }
-        else if ( strcmp(flavorStr, kHTMLMime) == 0 ) {
+        else if (flavorStr.EqualsLiteral(kHTMLMime)) {
           uint32_t startOfData = 0;
           // The JS folks want CF_HTML exactly as it is on the clipboard, but
           // minus the CF_HTML header index information.
           // It also needs to be converted to UTF16 and have linebreaks changed.
           if ( FindPlatformHTML(aDataObject, anIndex, &data, &startOfData, &dataLen) ) {
             dataLen -= startOfData;
             nsPrimitiveHelpers::CreatePrimitiveForCFHTML ( static_cast<char*>(data) + startOfData,
                                                            &dataLen, getter_AddRefs(genericDataWrapper) );
           }
           else
           {
             free(data);
             continue;     // something wrong with this flavor, keep looking for other data
           }
           free(data);
         }
-        else if ( strcmp(flavorStr, kJPEGImageMime) == 0 ||
-                  strcmp(flavorStr, kJPGImageMime) == 0 ||
-                  strcmp(flavorStr, kPNGImageMime) == 0) {
+        else if (flavorStr.EqualsLiteral(kJPEGImageMime) ||
+                 flavorStr.EqualsLiteral(kJPGImageMime) ||
+                 flavorStr.EqualsLiteral(kPNGImageMime)) {
           nsIInputStream * imageStream = reinterpret_cast<nsIInputStream*>(data);
           genericDataWrapper = do_QueryInterface(imageStream);
           NS_IF_RELEASE(imageStream);
         }
         else {
           // Treat custom types as a string of bytes.
-          if (strcmp(flavorStr, kCustomTypesMime) != 0) {
+          if (!flavorStr.EqualsLiteral(kCustomTypesMime)) {
             // we probably have some form of text. The DOM only wants LF, so convert from Win32 line 
             // endings to DOM line endings.
             int32_t signedLen = static_cast<int32_t>(dataLen);
-            nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks ( flavorStr, &data, &signedLen );
+            nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks(flavorStr, &data, &signedLen);
             dataLen = signedLen;
 
-            if (strcmp(flavorStr, kRTFMime) == 0) {
+            if (flavorStr.EqualsLiteral(kRTFMime)) {
               // RTF on Windows is known to sometimes deliver an extra null byte.
               if (dataLen > 0 && static_cast<char*>(data)[dataLen - 1] == '\0') {
                 dataLen--;
               }
             }
           }
 
-          nsPrimitiveHelpers::CreatePrimitiveForData ( flavorStr, data, dataLen, getter_AddRefs(genericDataWrapper) );
+          nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, data, dataLen, getter_AddRefs(genericDataWrapper));
           free(data);
         }
         
         NS_ASSERTION ( genericDataWrapper, "About to put null data into the transferable" );
-        aTransferable->SetTransferData(flavorStr, genericDataWrapper, dataLen);
+        aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper, dataLen);
         res = NS_OK;
 
         // we found one, get out of the loop
         break;
       }
 
     }
   } // foreach flavor
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -1336,17 +1336,18 @@ HRESULT nsDataObj::GetText(const nsACStr
   else
     flavorStr = flat.get();
 
   // NOTE: CreateDataFromPrimitive creates new memory, that needs to be deleted
   nsCOMPtr<nsISupports> genericDataWrapper;
   mTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper), &len);
   if ( !len )
     return E_FAIL;
-  nsPrimitiveHelpers::CreateDataFromPrimitive ( flavorStr, genericDataWrapper, &data, len );
+  nsPrimitiveHelpers::CreateDataFromPrimitive(
+    nsDependentCString(flavorStr), genericDataWrapper, &data, len);
   if ( !data )
     return E_FAIL;
 
   HGLOBAL     hGlobalMemory = nullptr;
 
   aSTG.tymed          = TYMED_HGLOBAL;
   aSTG.pUnkForRelease = nullptr;
 
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -784,24 +784,24 @@ NS_CreateServicesFromCategory(const char
   bool hasMore;
   while (NS_SUCCEEDED(senumerator->HasMore(&hasMore)) && hasMore) {
     // From here on just skip any error we get.
     nsAutoCString entryString;
     if (NS_FAILED(senumerator->GetNext(entryString))) {
       continue;
     }
 
-    nsXPIDLCString contractID;
+    nsCString contractID;
     rv = categoryManager->GetCategoryEntry(aCategory, entryString.get(),
                                            getter_Copies(contractID));
     if (NS_FAILED(rv)) {
       continue;
     }
 
-    nsCOMPtr<nsISupports> instance = do_GetService(contractID);
+    nsCOMPtr<nsISupports> instance = do_GetService(contractID.get());
     if (!instance) {
       LogMessage("While creating services from category '%s', could not create service for entry '%s', contract ID '%s'",
                  aCategory, entryString.get(), contractID.get());
       continue;
     }
 
     if (aObserverTopic) {
       // try an observer, if it implements it.
--- a/xpfe/components/directory/nsDirectoryViewer.cpp
+++ b/xpfe/components/directory/nsDirectoryViewer.cpp
@@ -1277,23 +1277,24 @@ nsDirectoryViewerFactory::CreateInstance
     // This is where we shunt the HTTP/Index stream into our datasource,
     // and open the directory viewer XUL file as the content stream to
     // load in its place.
 
     // Create a dummy loader that will load a stub XUL document.
     nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
     if (NS_FAILED(rv))
       return rv;
-    nsXPIDLCString contractID;
+    nsCString contractID;
     rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "application/vnd.mozilla.xul+xml",
                                   getter_Copies(contractID));
     if (NS_FAILED(rv))
       return rv;
 
-    nsCOMPtr<nsIDocumentLoaderFactory> factory(do_GetService(contractID, &rv));
+    nsCOMPtr<nsIDocumentLoaderFactory>
+      factory(do_GetService(contractID.get(), &rv));
     if (NS_FAILED(rv)) return rv;
 
     nsCOMPtr<nsIURI> uri;
     rv = NS_NewURI(getter_AddRefs(uri), "chrome://communicator/content/directory/directory.xul");
     if (NS_FAILED(rv)) return rv;
 
     nsCOMPtr<nsIChannel> channel;
     rv = NS_NewChannel(getter_AddRefs(channel),
@@ -1337,23 +1338,24 @@ nsDirectoryViewerFactory::CreateInstance
 
   // setup the original channel's content type
   (void)aChannel->SetContentType(NS_LITERAL_CSTRING("text/html"));
 
   // Otherwise, lets use the html listing
   nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
   if (NS_FAILED(rv))
     return rv;
-  nsXPIDLCString contractID;
+  nsCString contractID;
   rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "text/html",
                                 getter_Copies(contractID));
   if (NS_FAILED(rv))
     return rv;
 
-  nsCOMPtr<nsIDocumentLoaderFactory> factory(do_GetService(contractID, &rv));
+  nsCOMPtr<nsIDocumentLoaderFactory>
+    factory(do_GetService(contractID.get(), &rv));
   if (NS_FAILED(rv)) return rv;
 
   nsCOMPtr<nsIStreamListener> listener;
 
   if (viewSource) {
     rv = factory->CreateInstance("view-source", aChannel, aLoadGroup,
                                  NS_LITERAL_CSTRING("text/html; x-view-type=view-source"),
                                  aContainer, aExtraInfo, getter_AddRefs(listener),