Bug 806971 - avoid passing a "null" charset to GetUnicodeDecoder; r=hsivonen
authorNathan Froyd <froydnj@mozilla.com>
Mon, 29 Oct 2012 14:44:24 -0400
changeset 111928 6e2b4b8e759d262ca94da80721dabcd888f6b5a8
parent 111927 25cb48666bd68db628a3da96a3f22bb5f183780f
child 111929 86d8067fa9e5e22b785bb6091321fda03932ce91
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewershsivonen
bugs806971
milestone19.0a1
Bug 806971 - avoid passing a "null" charset to GetUnicodeDecoder; r=hsivonen
content/base/src/nsScriptLoader.cpp
--- a/content/base/src/nsScriptLoader.cpp
+++ b/content/base/src/nsScriptLoader.cpp
@@ -1020,17 +1020,17 @@ nsScriptLoader::ConvertToUTF16(nsIChanne
 
   if (!unicodeDecoder &&
       aChannel &&
       NS_SUCCEEDED(aChannel->GetContentCharset(charset))) {
     charsetConv->GetUnicodeDecoder(charset.get(),
                                    getter_AddRefs(unicodeDecoder));
   }
 
-  if (!unicodeDecoder) {
+  if (!unicodeDecoder && !aHintCharset.IsEmpty()) {
     CopyUTF16toUTF8(aHintCharset, charset);
     charsetConv->GetUnicodeDecoder(charset.get(),
                                    getter_AddRefs(unicodeDecoder));
   }
 
   if (!unicodeDecoder && aDocument) {
     charset = aDocument->GetDocumentCharacterSet();
     charsetConv->GetUnicodeDecoderRaw(charset.get(),