зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1102679 part 1. Pass around the TextDecoderOptions as needed, not just one boolean from it. r=hsivonen
This commit is contained in:
Родитель
81731ac92a
Коммит
ac9ade8709
|
@ -15,7 +15,8 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
void
|
||||
TextDecoder::Init(const nsAString& aLabel, const bool aFatal,
|
||||
TextDecoder::Init(const nsAString& aLabel,
|
||||
const TextDecoderOptions& aOptions,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// Let encoding be the result of getting an encoding from label.
|
||||
|
@ -28,18 +29,18 @@ TextDecoder::Init(const nsAString& aLabel, const bool aFatal,
|
|||
aRv.ThrowRangeError<MSG_ENCODING_NOT_SUPPORTED>(label);
|
||||
return;
|
||||
}
|
||||
InitWithEncoding(WrapNotNull(encoding), aFatal);
|
||||
InitWithEncoding(WrapNotNull(encoding), aOptions);
|
||||
}
|
||||
|
||||
void
|
||||
TextDecoder::InitWithEncoding(NotNull<const Encoding*> aEncoding,
|
||||
const bool aFatal)
|
||||
const TextDecoderOptions& aOptions)
|
||||
{
|
||||
aEncoding->Name(mEncoding);
|
||||
// If the constructor is called with an options argument,
|
||||
// and the fatal property of the dictionary is set,
|
||||
// set the internal fatal flag of the decoder object.
|
||||
mFatal = aFatal;
|
||||
mFatal = aOptions.mFatal;
|
||||
|
||||
// Create a decoder object for mEncoding.
|
||||
mDecoder = aEncoding->NewDecoderWithBOMRemoval();
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
ErrorResult& aRv)
|
||||
{
|
||||
nsAutoPtr<TextDecoder> txtDecoder(new TextDecoder());
|
||||
txtDecoder->Init(aEncoding, aOptions.mFatal, aRv);
|
||||
txtDecoder->Init(aEncoding, aOptions, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -60,22 +60,21 @@ public:
|
|||
* Validates provided label and throws an exception if invalid label.
|
||||
*
|
||||
* @param aLabel The encoding label (case insensitive) provided.
|
||||
* @param aFatal indicates whether to throw an 'EncodingError'
|
||||
* exception or not when decoding.
|
||||
* @param aOptions The TextDecoderOptions to use.
|
||||
* @return aRv EncodingError exception else null.
|
||||
*/
|
||||
void Init(const nsAString& aLabel, const bool aFatal, ErrorResult& aRv);
|
||||
void Init(const nsAString& aLabel, const TextDecoderOptions& aOptions,
|
||||
ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Performs initialization with a Gecko-canonical encoding name (as opposed
|
||||
* to a label.)
|
||||
*
|
||||
* @param aEncoding An Encoding object
|
||||
* @param aFatal indicates whether to throw an 'EncodingError'
|
||||
* exception or not when decoding.
|
||||
* @param aOptions The TextDecoderOptions to use.
|
||||
*/
|
||||
void InitWithEncoding(NotNull<const Encoding*> aEncoding,
|
||||
const bool aFatal);
|
||||
const TextDecoderOptions& aOptions);
|
||||
|
||||
/**
|
||||
* Return the encoding name.
|
||||
|
|
Загрузка…
Ссылка в новой задаче