Bug 1200869 - Empty the header value for code hygiene. r=sicking, a=2.1S+
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 02 Sep 2015 19:53:35 -0400
changeset 222386 b2a5888625dbd69d48d8566024b74db49175d7aa
parent 222385 9d414eb53b238f6e7a2903b8fd0a91c818cca893
child 222387 b17aed198708b4983e0a2f461a8fc61fe09c5a1a
push id244
push userryanvm@gmail.com
push dateThu, 03 Sep 2015 20:34:59 +0000
treeherdermozilla-b2g34_v2_1s@b2a5888625db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, 2
bugs1200869
milestone34.0
Bug 1200869 - Empty the header value for code hygiene. r=sicking, a=2.1S+
content/base/src/nsCrossSiteListenerProxy.cpp
--- a/content/base/src/nsCrossSiteListenerProxy.cpp
+++ b/content/base/src/nsCrossSiteListenerProxy.cpp
@@ -949,16 +949,17 @@ nsCORSPreflightListener::AddResultToCach
     sPreflightCache->GetEntry(uri, mReferrerPrincipal, mWithCredentials,
                               true);
   if (!entry) {
     return;
   }
 
   // The "Access-Control-Allow-Methods" header contains a comma separated
   // list of method names.
+  headerVal.Truncate();
   http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Methods"),
                           headerVal);
 
   nsCCharSeparatedTokenizer methods(headerVal, ',');
   while(methods.hasMoreTokens()) {
     const nsDependentCSubstring& method = methods.nextToken();
     if (method.IsEmpty()) {
       continue;
@@ -979,16 +980,17 @@ nsCORSPreflightListener::AddResultToCach
 
       newMethod->token = method;
       newMethod->expirationTime = expirationTime;
     }
   }
 
   // The "Access-Control-Allow-Headers" header contains a comma separated
   // list of method names.
+  headerVal.Truncate();
   http->GetResponseHeader(NS_LITERAL_CSTRING("Access-Control-Allow-Headers"),
                           headerVal);
 
   nsCCharSeparatedTokenizer headers(headerVal, ',');
   while(headers.hasMoreTokens()) {
     const nsDependentCSubstring& header = headers.nextToken();
     if (header.IsEmpty()) {
       continue;