Bug 1200856 - Avoid the extra variable to make the string manipulation faster. r=sicking, a=2.2+
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 02 Sep 2015 19:52:46 -0400
changeset 238799 c1ed0cd007f2ad022aa0268ae129bda938d36f8f
parent 238798 c03e2bc6a3a463b3bad84739f5ed30d8c18a7cfa
child 238800 d3cb4f28c73584204c63702705b7ae5118252f48
push id792
push userryanvm@gmail.com
push dateThu, 03 Sep 2015 20:27:11 +0000
treeherdermozilla-b2g37_v2_2@d3cb4f28c735 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, 2.2
bugs1200856
milestone37.0
Bug 1200856 - Avoid the extra variable to make the string manipulation faster. r=sicking, a=2.2+
dom/security/nsCORSListenerProxy.cpp
--- a/dom/security/nsCORSListenerProxy.cpp
+++ b/dom/security/nsCORSListenerProxy.cpp
@@ -354,29 +354,28 @@ nsPreflightCache::GetCacheKey(nsIURI* aU
   
   nsAutoCString scheme, host, port;
   if (uri) {
     uri->GetScheme(scheme);
     uri->GetHost(host);
     port.AppendInt(NS_GetRealPort(uri));
   }
 
-  nsAutoCString cred;
   if (aWithCredentials) {
     _retval.AssignLiteral("cred");
   }
   else {
     _retval.AssignLiteral("nocred");
   }
 
   nsAutoCString spec;
   rv = aURI->GetSpec(spec);
   NS_ENSURE_SUCCESS(rv, false);
 
-  _retval.Assign(cred + space + scheme + space + host + space + port + space +
+  _retval.Append(space + scheme + space + host + space + port + space +
                  spec);
 
   return true;
 }
 
 //////////////////////////////////////////////////////////////////////////
 // nsCORSListenerProxy