Bug 1366595 - Improve the use of strings in XHR logging. r=smaug, a=abillings
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 24 May 2017 20:27:20 -0400
changeset 396409 d3ce3e3812c9372a12b6416f0ceedd2e768b5277
parent 396408 a9c5f2fbb7fbdef723b6d954aef9c21456a718c7
child 396410 51c849c595a0b5428d1d56e4ae668653437283e2
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, abillings
bugs1366595
milestone54.0
Bug 1366595 - Improve the use of strings in XHR logging. r=smaug, a=abillings
dom/xhr/XMLHttpRequestMainThread.cpp
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -3054,17 +3054,18 @@ XMLHttpRequestMainThread::SetRequestHead
   if (!NS_IsValidHTTPToken(aName) || !NS_IsReasonableHTTPHeaderValue(value)) {
     return NS_ERROR_DOM_INVALID_HEADER_NAME;
   }
 
   // Step 5
   bool isPrivilegedCaller = IsSystemXHR();
   bool isForbiddenHeader = nsContentUtils::IsForbiddenRequestHeader(aName);
   if (!isPrivilegedCaller && isForbiddenHeader) {
-    const char16_t* params[] = { NS_ConvertUTF8toUTF16(aName).get() };
+    NS_ConvertUTF8toUTF16 name(aName);
+    const char16_t* params[] = { name.get() };
     LogMessage("ForbiddenHeaderWarning", GetOwner(), params, ArrayLength(params));
     return NS_OK;
   }
 
   // Step 6.1
   // Skipping for now, as normalizing the case of header names may not be
   // web-compatible. See bug 1285036.