Bug 869836 - Part 9a: Use AssignLiteral(MOZ_UTF16(...)) instead of Assign(NS_LITERAL_STRING(...)). r=ehsan
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Mon, 26 May 2014 21:54:10 +0300
changeset 185147 e0180fb7eec1e2af377e1bcdbc166b9b497a620a
parent 185146 59eefc86501af9789931aed1672dfa9461375316
child 185148 9fa72130d50b7d82771e489399ec321c24c2fc8c
push id26844
push userryanvm@gmail.com
push dateTue, 27 May 2014 20:23:53 +0000
treeherdermozilla-central@448f2153d6d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs869836
milestone32.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 869836 - Part 9a: Use AssignLiteral(MOZ_UTF16(...)) instead of Assign(NS_LITERAL_STRING(...)). r=ehsan Relading with correct bug number so DONTBUILD.
content/base/src/nsDocument.cpp
content/base/src/nsHTMLContentSerializer.cpp
content/media/webrtc/MediaEngineDefault.cpp
content/media/webrtc/MediaEngineTabVideoSource.cpp
docshell/base/nsDocShell.cpp
dom/media/MediaManager.cpp
gfx/thebes/gfxFontUtils.cpp
gfx/thebes/gfxWindowsPlatform.cpp
image/decoders/icon/gtk/nsIconChannel.cpp
layout/base/nsPresShell.cpp
layout/style/nsROCSSPrimitiveValue.cpp
netwerk/base/src/Dashboard.cpp
uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
widget/gtk/nsWindow.cpp
widget/qt/nsWindow.cpp
xpcom/io/nsLocalFileWin.cpp
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -2965,17 +2965,17 @@ nsDocument::GetLastModified(nsAString& a
 void
 nsIDocument::GetLastModified(nsAString& aLastModified) const
 {
   if (!mLastModified.IsEmpty()) {
     aLastModified.Assign(mLastModified);
   } else {
     // If we for whatever reason failed to find the last modified time
     // (or even the current time), fall back to what NS4.x returned.
-    aLastModified.AssignLiteral("01/01/1970 00:00:00");
+    aLastModified.AssignLiteral(MOZ_UTF16("01/01/1970 00:00:00"));
   }
 }
 
 void
 nsDocument::AddToNameTable(Element *aElement, nsIAtom* aName)
 {
   MOZ_ASSERT(nsGenericHTMLElement::ShouldExposeNameAsHTMLDocumentProperty(aElement),
              "Only put elements that need to be exposed as document['name'] in "
@@ -9168,26 +9168,26 @@ nsDocument::GetReadyState(nsAString& aRe
   return NS_OK;
 }
 
 void
 nsIDocument::GetReadyState(nsAString& aReadyState) const
 {
   switch(mReadyState) {
   case READYSTATE_LOADING :
-    aReadyState.AssignLiteral("loading");
+    aReadyState.AssignLiteral(MOZ_UTF16("loading"));
     break;
   case READYSTATE_INTERACTIVE :
-    aReadyState.AssignLiteral("interactive");
+    aReadyState.AssignLiteral(MOZ_UTF16("interactive"));
     break;
   case READYSTATE_COMPLETE :
-    aReadyState.AssignLiteral("complete");
+    aReadyState.AssignLiteral(MOZ_UTF16("complete"));
     break;
   default:
-    aReadyState.AssignLiteral("uninitialized");
+    aReadyState.AssignLiteral(MOZ_UTF16("uninitialized"));
   }
 }
 
 namespace {
 
 struct SuppressArgs
 {
   nsIDocument::SuppressionType mWhat;
--- a/content/base/src/nsHTMLContentSerializer.cpp
+++ b/content/base/src/nsHTMLContentSerializer.cpp
@@ -152,19 +152,19 @@ nsHTMLContentSerializer::SerializeHTMLAt
         valueStr = NS_LITERAL_STRING("text/html; charset=") +
           NS_ConvertASCIItoUTF16(mCharset);
       }
     }
 
     nsDependentAtomString nameStr(attrName);
     nsAutoString prefix;
     if (namespaceID == kNameSpaceID_XML) {
-      prefix.AssignLiteral("xml");
+      prefix.AssignLiteral(MOZ_UTF16("xml"));
     } else if (namespaceID == kNameSpaceID_XLink) {
-      prefix.AssignLiteral("xlink");
+      prefix.AssignLiteral(MOZ_UTF16("xlink"));
     }
 
     // Expand shorthand attribute.
     if (aNamespace == kNameSpaceID_XHTML &&
         namespaceID == kNameSpaceID_None &&
         IsShorthandAttr(attrName, aTagName) &&
         valueStr.IsEmpty()) {
       valueStr = nameStr;
--- a/content/media/webrtc/MediaEngineDefault.cpp
+++ b/content/media/webrtc/MediaEngineDefault.cpp
@@ -46,24 +46,24 @@ MediaEngineDefaultVideoSource::MediaEngi
 }
 
 MediaEngineDefaultVideoSource::~MediaEngineDefaultVideoSource()
 {}
 
 void
 MediaEngineDefaultVideoSource::GetName(nsAString& aName)
 {
-  aName.AssignLiteral("Default Video Device");
+  aName.AssignLiteral(MOZ_UTF16("Default Video Device"));
   return;
 }
 
 void
 MediaEngineDefaultVideoSource::GetUUID(nsAString& aUUID)
 {
-  aUUID.AssignLiteral("1041FCBD-3F12-4F7B-9E9B-1EC556DD5676");
+  aUUID.AssignLiteral(MOZ_UTF16("1041FCBD-3F12-4F7B-9E9B-1EC556DD5676"));
   return;
 }
 
 nsresult
 MediaEngineDefaultVideoSource::Allocate(const VideoTrackConstraintsN &aConstraints,
                                         const MediaEnginePrefs &aPrefs)
 {
   if (mState != kReleased) {
@@ -357,24 +357,24 @@ MediaEngineDefaultAudioSource::MediaEngi
 }
 
 MediaEngineDefaultAudioSource::~MediaEngineDefaultAudioSource()
 {}
 
 void
 MediaEngineDefaultAudioSource::GetName(nsAString& aName)
 {
-  aName.AssignLiteral("Default Audio Device");
+  aName.AssignLiteral(MOZ_UTF16("Default Audio Device"));
   return;
 }
 
 void
 MediaEngineDefaultAudioSource::GetUUID(nsAString& aUUID)
 {
-  aUUID.AssignLiteral("B7CBD7C1-53EF-42F9-8353-73F61C70C092");
+  aUUID.AssignLiteral(MOZ_UTF16("B7CBD7C1-53EF-42F9-8353-73F61C70C092"));
   return;
 }
 
 nsresult
 MediaEngineDefaultAudioSource::Allocate(const AudioTrackConstraintsN &aConstraints,
                                         const MediaEnginePrefs &aPrefs)
 {
   if (mState != kReleased) {
--- a/content/media/webrtc/MediaEngineTabVideoSource.cpp
+++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp
@@ -104,23 +104,23 @@ MediaEngineTabVideoSource::InitRunnable:
   nsCOMPtr<nsIRunnable> start(new StartRunnable(mVideoSource));
   start->Run();
   return NS_OK;
 }
 
 void
 MediaEngineTabVideoSource::GetName(nsAString_internal& aName)
 {
-  aName.AssignLiteral("&getUserMedia.videoDevice.tabShare;");
+  aName.AssignLiteral(MOZ_UTF16("&getUserMedia.videoDevice.tabShare;"));
 }
 
 void
 MediaEngineTabVideoSource::GetUUID(nsAString_internal& aUuid)
 {
-  aUuid.AssignLiteral("uuid");
+  aUuid.AssignLiteral(MOZ_UTF16("uuid"));
 }
 
 nsresult
 MediaEngineTabVideoSource::Allocate(const VideoTrackConstraintsN&,
                                     const MediaEnginePrefs&)
 {
   return NS_OK;
 }
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4607,17 +4607,17 @@ nsDocShell::DisplayLoadError(nsresult aE
         nsCOMPtr<Element> element = do_QueryInterface(handler);
         element->GetAttribute(NS_LITERAL_STRING("crashedPageTitle"), messageStr);
       }
 
       // DisplayLoadError requires a non-empty messageStr to proceed and call LoadErrorPage.
       // If the page doesn't have a title, we will use a blank space which will be trimmed
       // and thus treated as empty by the front-end.
       if (messageStr.IsEmpty()) {
-        messageStr.Assign(' ');
+        messageStr.AssignLiteral(MOZ_UTF16(" "));
       }
     }
     else {
         // Errors requiring simple formatting
         switch (aError) {
         case NS_ERROR_MALFORMED_URI:
             // URI is malformed
             error.AssignLiteral("malformedURI");
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -326,24 +326,24 @@ NS_IMETHODIMP
 MediaDevice::GetType(nsAString& aType)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 VideoDevice::GetType(nsAString& aType)
 {
-  aType.AssignLiteral("video");
+  aType.AssignLiteral(MOZ_UTF16("video"));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AudioDevice::GetType(nsAString& aType)
 {
-  aType.AssignLiteral("audio");
+  aType.AssignLiteral(MOZ_UTF16("audio"));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 MediaDevice::GetId(nsAString& aID)
 {
   aID.Assign(mID);
   return NS_OK;
@@ -1829,17 +1829,17 @@ MediaManager::Observe(nsISupports* aSubj
   } else if (!strcmp(aTopic, "getUserMedia:response:deny")) {
     nsString errorMessage(NS_LITERAL_STRING("PERMISSION_DENIED"));
 
     if (aSubject) {
       nsCOMPtr<nsISupportsString> msg(do_QueryInterface(aSubject));
       MOZ_ASSERT(msg);
       msg->GetData(errorMessage);
       if (errorMessage.IsEmpty())
-        errorMessage.AssignLiteral("UNKNOWN_ERROR");
+        errorMessage.AssignLiteral(MOZ_UTF16("UNKNOWN_ERROR"));
     }
 
     nsString key(aData);
     nsRefPtr<GetUserMediaRunnable> runnable;
     if (!mActiveCallbacks.Get(key, getter_AddRefs(runnable))) {
       return NS_OK;
     }
     mActiveCallbacks.Remove(key);
--- a/gfx/thebes/gfxFontUtils.cpp
+++ b/gfx/thebes/gfxFontUtils.cpp
@@ -781,17 +781,17 @@ nsresult gfxFontUtils::MakeUniqueUserFon
 
     // all b64 characters except for '/' are allowed in Postscript names, so convert / ==> -
     char *p;
     for (p = guidB64; *p; p++) {
         if (*p == '/')
             *p = '-';
     }
 
-    aName.AssignLiteral("uf");
+    aName.AssignLiteral(MOZ_UTF16("uf"));
     aName.AppendASCII(guidB64);
     return NS_OK;
 }
 
 
 // TrueType/OpenType table handling code
 
 // need byte aligned structs
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1128,17 +1128,17 @@ gfxWindowsPlatform::UseClearTypeAlways()
     return mUseClearTypeAlways;
 }
 
 void 
 gfxWindowsPlatform::GetDLLVersion(char16ptr_t aDLLPath, nsAString& aVersion)
 {
     DWORD versInfoSize, vers[4] = {0};
     // version info not available case
-    aVersion.AssignLiteral("0.0.0.0");
+    aVersion.AssignLiteral(MOZ_UTF16("0.0.0.0"));
     versInfoSize = GetFileVersionInfoSizeW(aDLLPath, nullptr);
     nsAutoTArray<BYTE,512> versionInfo;
     
     if (versInfoSize == 0 ||
         !versionInfo.AppendElements(uint32_t(versInfoSize)))
     {
         return;
     }
--- a/image/decoders/icon/gtk/nsIconChannel.cpp
+++ b/image/decoders/icon/gtk/nsIconChannel.cpp
@@ -320,17 +320,17 @@ nsIconChannel::InitWithGnome(nsIMozIconU
                                 getter_AddRefs(bundle));
     nsAutoString appName;
 
     if (bundle) {
       bundle->GetStringFromName(MOZ_UTF16("brandShortName"),
                                 getter_Copies(appName));
     } else {
       NS_WARNING("brand.properties not present, using default application name");
-      appName.AssignLiteral("Gecko");
+      appName.AssignLiteral(MOZ_UTF16("Gecko"));
     }
 
     char* empty[] = { "" };
     _gnome_init(NS_ConvertUTF16toUTF8(appName).get(),
                 "1.0", 1, empty, nullptr, 0, nullptr);
   }
 
   uint32_t iconSize = GetIconSize(aIconURI);
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -8933,23 +8933,23 @@ PresShell::DelayedKeyEvent::DelayedKeyEv
 
 static void
 LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
 {
   nsAutoString n1, n2;
   if (k1) {
     k1->GetFrameName(n1);
   } else {
-    n1.AssignLiteral("(null)");
+    n1.AssignLiteral(MOZ_UTF16("(null)"));
   }
 
   if (k2) {
     k2->GetFrameName(n2);
   } else {
-    n2.AssignLiteral("(null)");
+    n2.AssignLiteral(MOZ_UTF16("(null)"));
   }
 
   printf("verifyreflow: %s %p != %s %p  %s\n",
          NS_LossyConvertUTF16toASCII(n1).get(), (void*)k1,
          NS_LossyConvertUTF16toASCII(n2).get(), (void*)k2, aMsg);
 }
 
 static void
--- a/layout/style/nsROCSSPrimitiveValue.cpp
+++ b/layout/style/nsROCSSPrimitiveValue.cpp
@@ -108,17 +108,17 @@ nsROCSSPrimitiveValue::GetCssText(nsAStr
           nsStyleUtil::AppendEscapedCSSString(NS_ConvertUTF8toUTF16(specUTF8),
                                               tmpStr);
           tmpStr.Append(')');
         } else {
           // http://dev.w3.org/csswg/css3-values/#attr defines
           // 'about:invalid' as the default value for url attributes,
           // so let's also use it here as the default computed value
           // for invalid URLs.
-          tmpStr.AssignLiteral("url(about:invalid)");
+          tmpStr.AssignLiteral(MOZ_UTF16("url(about:invalid)"));
         }
         break;
       }
     case CSS_ATTR :
       {
         tmpStr.AppendLiteral("attr(");
         tmpStr.Append(mValue.mString);
         tmpStr.Append(char16_t(')'));
--- a/netwerk/base/src/Dashboard.cpp
+++ b/netwerk/base/src/Dashboard.cpp
@@ -186,17 +186,17 @@ ConnectionData::Notify(nsITimer *aTimer)
     if (mSocket) {
         mSocket->Close(NS_ERROR_ABORT);
         mSocket = nullptr;
         mStreamIn = nullptr;
     }
 
     mTimer = nullptr;
 
-    mStatus.AssignLiteral("NS_ERROR_NET_TIMEOUT");
+    mStatus.AssignLiteral(MOZ_UTF16("NS_ERROR_NET_TIMEOUT"));
     nsCOMPtr<nsIRunnable> event =
         NS_NewRunnableMethodWithArg<nsRefPtr<ConnectionData> >
         (mDashboard, &Dashboard::GetConnectionStatus, this);
     mThread->Dispatch(event, NS_DISPATCH_NORMAL);
 
     return NS_OK;
 }
 
@@ -749,39 +749,39 @@ Dashboard::RequestDNSLookup(const nsACSt
     return rv;
 }
 
 void
 HttpConnInfo::SetHTTP1ProtocolVersion(uint8_t pv)
 {
     switch (pv) {
     case NS_HTTP_VERSION_0_9:
-        protocolVersion.AssignLiteral("http/0.9");
+        protocolVersion.AssignLiteral(MOZ_UTF16("http/0.9"));
         break;
     case NS_HTTP_VERSION_1_0:
-        protocolVersion.AssignLiteral("http/1.0");
+        protocolVersion.AssignLiteral(MOZ_UTF16("http/1.0"));
         break;
     case NS_HTTP_VERSION_1_1:
-        protocolVersion.AssignLiteral("http/1.1");
+        protocolVersion.AssignLiteral(MOZ_UTF16("http/1.1"));
         break;
     case NS_HTTP_VERSION_2_0:
-        protocolVersion.AssignLiteral("http/2.0");
+        protocolVersion.AssignLiteral(MOZ_UTF16("http/2.0"));
         break;
     default:
-        protocolVersion.AssignLiteral("unknown protocol version");
+        protocolVersion.AssignLiteral(MOZ_UTF16("unknown protocol version"));
     }
 }
 
 void
 HttpConnInfo::SetHTTP2ProtocolVersion(uint8_t pv)
 {
     if (pv == SPDY_VERSION_3) {
-        protocolVersion.AssignLiteral("spdy/3");
+        protocolVersion.AssignLiteral(MOZ_UTF16("spdy/3"));
     } else if (pv == SPDY_VERSION_31) {
-        protocolVersion.AssignLiteral("spdy/3.1");
+        protocolVersion.AssignLiteral(MOZ_UTF16("spdy/3.1"));
     } else {
         MOZ_ASSERT (pv == NS_HTTP2_DRAFT_VERSION);
         protocolVersion.Assign(NS_LITERAL_STRING(NS_HTTP2_DRAFT_TOKEN));
     }
 }
 
 NS_IMETHODIMP
 Dashboard::RequestConnection(const nsACString& aHost, uint32_t aPort,
--- a/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
+++ b/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp
@@ -377,28 +377,28 @@ nsMIMEInfoAndroid::nsMIMEInfoAndroid(con
   mHandlerApps = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   mHandlerApps->AppendElement(mPrefApp, false);
 }
 
 NS_IMPL_ISUPPORTS(nsMIMEInfoAndroid::SystemChooser, nsIHandlerApp)
 
 
 nsresult nsMIMEInfoAndroid::SystemChooser::GetName(nsAString & aName) {
-  aName.AssignLiteral("Android chooser");
+  aName.AssignLiteral(MOZ_UTF16("Android chooser"));
   return NS_OK;
 }
 
 nsresult
 nsMIMEInfoAndroid::SystemChooser::SetName(const nsAString&) {
   return NS_OK;
 }
 
 nsresult
 nsMIMEInfoAndroid::SystemChooser::GetDetailedDescription(nsAString & aDesc) {
-  aDesc.AssignLiteral("Android's default handler application chooser");
+  aDesc.AssignLiteral(MOZ_UTF16("Android's default handler application chooser"));
   return NS_OK;
 }
 
 nsresult
 nsMIMEInfoAndroid::SystemChooser::SetDetailedDescription(const nsAString&) {
   return NS_OK;
 }
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3284,17 +3284,17 @@ GetBrandName(nsXPIDLString& brandName)
             getter_AddRefs(bundle));
 
     if (bundle)
         bundle->GetStringFromName(
             MOZ_UTF16("brandShortName"),
             getter_Copies(brandName));
 
     if (brandName.IsEmpty())
-        brandName.AssignLiteral("Mozilla");
+        brandName.AssignLiteral(MOZ_UTF16("Mozilla"));
 }
 
 static GdkWindow *
 CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
 {
     GdkWindowAttr attributes;
     gint          attributes_mask = GDK_WA_VISUAL;
 
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -1966,17 +1966,17 @@ GetBrandName(nsXPIDLString& brandName)
 
     if (bundle) {
         bundle->GetStringFromName(
             MOZ_UTF16("brandShortName"),
             getter_Copies(brandName));
     }
 
     if (brandName.IsEmpty()) {
-        brandName.AssignLiteral("Mozilla");
+        brandName.AssignLiteral(MOZ_UTF16("Mozilla"));
     }
 }
 
 NS_IMETHODIMP
 nsWindow::SetWindowClass(const nsAString &xulWinType)
 {
     if (!mWidget) {
         return NS_ERROR_FAILURE;
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -233,17 +233,17 @@ private:
     if (ShellExecuteExW(&seinfo)) {
       return NS_OK;
     }
     DWORD r = GetLastError();
     // if the file has no association, we launch windows'
     // "what do you want to do" dialog
     if (r == SE_ERR_NOASSOC) {
       nsAutoString shellArg;
-      shellArg.AssignLiteral("shell32.dll,OpenAs_RunDLL ");
+      shellArg.AssignLiteral(MOZ_UTF16("shell32.dll,OpenAs_RunDLL "));
       shellArg.Append(mResolvedPath);
       seinfo.lpFile = L"RUNDLL32.EXE";
       seinfo.lpParameters = shellArg.get();
       if (ShellExecuteExW(&seinfo)) {
         return NS_OK;
       }
       r = GetLastError();
     }