Bug 1018829. r=sstamm
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 03 Jun 2014 15:02:19 +0900
changeset 205464 04dd691d5f5954f0af1748d9d5940df2246047eb
parent 205463 817ede736aab62fe7cec62d4826dd5318eb2b894
child 205465 4a2ec83f83922e91c38eb5ca86f650c464f502d8
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstamm
bugs1018829
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 1018829. r=sstamm
content/base/src/nsCSPParser.cpp
content/base/src/nsCSPService.cpp
--- a/content/base/src/nsCSPParser.cpp
+++ b/content/base/src/nsCSPParser.cpp
@@ -691,17 +691,18 @@ nsCSPParser::sourceList(nsTArray<nsCSPBa
   if (isNone) {
     // If the directive contains no other srcs, then we set the 'none'
     if (outSrcs.Length() == 0) {
       nsCSPKeywordSrc *keyword = new nsCSPKeywordSrc(CSP_NONE);
       outSrcs.AppendElement(keyword);
     }
     // Otherwise, we ignore 'none' and report a warning
     else {
-      const char16_t* params[] = { NS_ConvertUTF8toUTF16(CSP_EnumToKeyword(CSP_NONE)).get() };
+      NS_ConvertUTF8toUTF16 unicodeNone(CSP_EnumToKeyword(CSP_NONE));
+      const char16_t* params[] = { unicodeNone.get() };
       logWarningErrorToConsole(nsIScriptError::warningFlag, "ignoringUnknownOption",
                                params, ArrayLength(params));
     }
   }
 }
 
 void
 nsCSPParser::reportURIList(nsTArray<nsCSPBaseSrc*>& outSrcs)
@@ -882,17 +883,18 @@ nsCSPParser::parseContentSecurityPolicy(
 
   // Check that report-only policies define a report-uri, otherwise log warning.
   if (aReportOnly) {
     policy->setReportOnlyFlag(true);
     if (!policy->directiveExists(CSP_REPORT_URI)) {
       nsAutoCString prePath;
       nsresult rv = aSelfURI->GetPrePath(prePath);
       NS_ENSURE_SUCCESS(rv, policy);
-      const char16_t* params[] = { NS_ConvertUTF8toUTF16(prePath).get() };
+      NS_ConvertUTF8toUTF16 unicodePrePath(prePath);
+      const char16_t* params[] = { unicodePrePath.get() };
       parser.logWarningErrorToConsole(nsIScriptError::warningFlag, "reportURInotInReportOnlyHeader",
                                       params, ArrayLength(params));
     }
   }
 
   if (policy->getNumDirectives() == 0) {
     // Individual errors were already reported in the parser, but if
     // we do not have an enforcable directive at all, we return null.
--- a/content/base/src/nsCSPService.cpp
+++ b/content/base/src/nsCSPService.cpp
@@ -362,17 +362,18 @@ CSPService::AsyncOnChannelRedirect(nsICh
       return NS_OK;
     }
   }
 
   // The redirecting channel isn't a writable property bag, we won't be able
   // to enforce the load policy if it redirects again, so we stop it now.
   nsAutoCString newUriSpec;
   rv = newUri->GetSpec(newUriSpec);
-  const char16_t *formatParams[] = { NS_ConvertUTF8toUTF16(newUriSpec).get() };
+  NS_ConvertUTF8toUTF16 unicodeSpec(newUriSpec);
+  const char16_t *formatParams[] = { unicodeSpec.get() };
   if (NS_SUCCEEDED(rv)) {
     nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                     NS_LITERAL_CSTRING("Redirect Error"), nullptr,
                                     nsContentUtils::eDOM_PROPERTIES,
                                     "InvalidRedirectChannelWarning",
                                     formatParams, 1);
   }