Bug 801402 - Use FindEncodingForLabel from OS.File. r=sicking

This commit is contained in:
Masatoshi Kimura 2012-11-07 18:04:21 -05:00
parent b7bc4daca4
commit 987290239c

View File

@ -12,7 +12,6 @@
#include "nsISeekableStream.h"
#include "jsfriendapi.h"
#include "nsCharsetAlias.h"
#include "nsEventDispatcher.h"
#include "nsNetUtil.h"
#include "nsDOMClassInfoID.h"
@ -33,9 +32,12 @@
#include "nsError.h"
#include "nsContentUtils.h"
#include "mozilla/dom/EncodingUtils.h"
#define STREAM_COPY_BLOCK_SIZE 32768
USING_FILE_NAMESPACE
using mozilla::dom::EncodingUtils;
namespace {
@ -1054,8 +1056,9 @@ ReadTextHelper::GetSuccessResult(JSContext* aCx,
}
nsCString charset;
rv = nsCharsetAlias::GetPreferred(charsetGuess, charset);
NS_ENSURE_SUCCESS(rv, rv);
if (!EncodingUtils::FindEncodingForLabel(charsetGuess, charset)) {
return NS_ERROR_DOM_ENCODING_NOT_SUPPORTED_ERR;
}
nsString tmpString;
rv = nsContentUtils::ConvertStringFromCharset(charset, mStream->Data(),