зеркало из https://github.com/mozilla/gecko-dev.git
merge mozilla-central to mozilla-inbound. r=merge a=merge
This commit is contained in:
Коммит
1f7d31312c
|
@ -44,7 +44,7 @@ function copyToTempUTF8File(file, charset) {
|
|||
try {
|
||||
let converterOut = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
converterOut.init(bufferedOut, "utf-8", 0, 0x0000);
|
||||
converterOut.init(bufferedOut, "utf-8");
|
||||
try {
|
||||
converterOut.writeString(inputStr || "");
|
||||
bufferedOut.QueryInterface(Ci.nsISafeOutputStream).finish();
|
||||
|
|
|
@ -90,7 +90,7 @@ var HarUtils = {
|
|||
|
||||
let convertor = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
convertor.init(foStream, "UTF-8", 0, 0);
|
||||
convertor.init(foStream, "UTF-8");
|
||||
|
||||
// The entire jsonString can be huge so, write the data in chunks.
|
||||
let chunkLength = 1024 * 1024;
|
||||
|
|
|
@ -215,9 +215,9 @@
|
|||
#include "nsIURL.h"
|
||||
#include "nsIWebBrowserFind.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/PerformanceNavigation.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
#ifdef MOZ_TOOLKIT_SEARCH
|
||||
#include "nsIBrowserSearchService.h"
|
||||
|
@ -2116,16 +2116,16 @@ nsDocShell::SetForcedCharset(const nsACString& aCharset)
|
|||
mForcedCharset.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabel(aCharset, encoding)) {
|
||||
const Encoding* encoding = Encoding::ForLabel(aCharset);
|
||||
if (!encoding) {
|
||||
// Reject unknown labels
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
if (!EncodingUtils::IsAsciiCompatible(encoding)) {
|
||||
if (!encoding->IsAsciiCompatible() && encoding != ISO_2022_JP_ENCODING) {
|
||||
// Reject XSS hazards
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
mForcedCharset = encoding;
|
||||
encoding->Name(mForcedCharset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -4498,45 +4498,6 @@ nsContentUtils::GetSubdocumentWithOuterWindowId(nsIDocument *aDocument,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// Convert the string from the given encoding to Unicode.
|
||||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::ConvertStringFromEncoding(const nsACString& aEncoding,
|
||||
const char* aInput,
|
||||
uint32_t aInputLen,
|
||||
nsAString& aOutput)
|
||||
{
|
||||
const Encoding* encoding;
|
||||
if (aEncoding.IsEmpty()) {
|
||||
encoding = UTF_8_ENCODING;
|
||||
} else {
|
||||
encoding = Encoding::ForName(aEncoding);
|
||||
}
|
||||
nsresult rv = encoding->DecodeWithBOMRemoval(MakeSpan(reinterpret_cast<const uint8_t*>(aInput), aInputLen), aOutput);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::CheckForBOM(const unsigned char* aBuffer, uint32_t aLength,
|
||||
nsACString& aCharset)
|
||||
{
|
||||
auto span = MakeSpan(reinterpret_cast<const uint8_t*>(aBuffer), aLength);
|
||||
const Encoding* encoding;
|
||||
size_t bomLength;
|
||||
Tie(encoding, bomLength) = Encoding::ForBOM(span);
|
||||
Unused << bomLength;
|
||||
if (!encoding) {
|
||||
aCharset.Truncate();
|
||||
return false;
|
||||
}
|
||||
encoding->Name(aCharset);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::RegisterShutdownObserver(nsIObserver* aObserver)
|
||||
|
|
|
@ -618,42 +618,6 @@ public:
|
|||
nsIDocument* aDocument,
|
||||
nsIURI* aBaseURI);
|
||||
|
||||
/**
|
||||
* Convert aInput (in encoding aEncoding) to UTF16 in aOutput.
|
||||
*
|
||||
* @deprecated Use mozilla::Encoding::DecodeWithBOMRemoval() in new code.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1369020
|
||||
*
|
||||
* @param aEncoding the Gecko-canonical name of the encoding or the empty
|
||||
* string (meaning UTF-8)
|
||||
*/
|
||||
static nsresult ConvertStringFromEncoding(const nsACString& aEncoding,
|
||||
const char* aInput,
|
||||
uint32_t aInputLen,
|
||||
nsAString& aOutput);
|
||||
|
||||
static nsresult ConvertStringFromEncoding(const nsACString& aEncoding,
|
||||
const nsACString& aInput,
|
||||
nsAString& aOutput) {
|
||||
return ConvertStringFromEncoding(
|
||||
aEncoding, aInput.BeginReading(), aInput.Length(), aOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a buffer begins with a BOM for UTF-8, UTF-16LE,
|
||||
* UTF-16BE
|
||||
*
|
||||
* @deprecated Use mozilla::Encoding::ForBOM() in new code.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1369022
|
||||
*
|
||||
* @param aBuffer the buffer to check
|
||||
* @param aLength the length of the buffer
|
||||
* @param aCharset empty if not found
|
||||
* @return boolean indicating whether a BOM was detected.
|
||||
*/
|
||||
static bool CheckForBOM(const unsigned char* aBuffer, uint32_t aLength,
|
||||
nsACString& aCharset);
|
||||
|
||||
/**
|
||||
* Returns true if |aName| is a valid name to be registered via
|
||||
* document.registerElement.
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
|
||||
#include "nsSMILAnimationController.h"
|
||||
|
@ -3844,9 +3844,9 @@ nsDocument::TryChannelCharset(nsIChannel *aChannel,
|
|||
nsAutoCString charsetVal;
|
||||
nsresult rv = aChannel->GetContentCharset(charsetVal);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoCString preferred;
|
||||
if(EncodingUtils::FindEncodingForLabel(charsetVal, preferred)) {
|
||||
aCharset = preferred;
|
||||
const Encoding* preferred = Encoding::ForLabel(charsetVal);
|
||||
if (preferred) {
|
||||
preferred->Name(aCharset);
|
||||
aCharsetSource = kCharsetFromChannel;
|
||||
return;
|
||||
} else if (aExecutor && !charsetVal.IsEmpty()) {
|
||||
|
@ -9930,10 +9930,9 @@ nsDocument::ScrollToRef()
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
const nsACString &docCharset = GetDocumentCharacterSet();
|
||||
const Encoding* encoding = Encoding::ForName(docCharset);
|
||||
|
||||
rv = nsContentUtils::ConvertStringFromEncoding(docCharset,
|
||||
unescapedRef,
|
||||
ref);
|
||||
rv = encoding->DecodeWithoutBOMHandling(unescapedRef, ref);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !ref.IsEmpty()) {
|
||||
rv = shell->GoToAnchor(ref, mChangeScrollPosWhenScrollingToRef);
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsStringBuffer.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
|
@ -33,13 +33,14 @@ nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI,
|
|||
|
||||
nsAutoCString charset;
|
||||
aURI->GetOriginCharset(charset);
|
||||
const Encoding* encoding = charset.IsEmpty() ?
|
||||
UTF_8_ENCODING : Encoding::ForName(charset);
|
||||
nsAutoString ref;
|
||||
nsresult rv = nsContentUtils::ConvertStringFromEncoding(charset,
|
||||
refPart,
|
||||
ref);
|
||||
nsresult rv = encoding->DecodeWithoutBOMHandling(refPart, ref);
|
||||
if (NS_FAILED(rv) || ref.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
rv = NS_OK;
|
||||
|
||||
// Get the current document
|
||||
nsIDocument *doc = aFromContent->OwnerDoc();
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
#include "mozilla/ArrayUtils.h" // ArrayLength
|
||||
#include "nsUConvPropertySearch.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
static constexpr nsUConvProp labelsEncodings[] = {
|
||||
#include "labelsencodings.properties.h"
|
||||
};
|
||||
|
||||
static constexpr nsUConvProp encodingsGroups[] = {
|
||||
#include "encodingsgroups.properties.h"
|
||||
};
|
||||
|
||||
bool
|
||||
EncodingUtils::FindEncodingForLabel(const nsACString& aLabel,
|
||||
nsACString& aOutEncoding)
|
||||
{
|
||||
auto encoding = Encoding::ForLabel(aLabel);
|
||||
if (!encoding) {
|
||||
aOutEncoding.Truncate();
|
||||
return false;
|
||||
}
|
||||
encoding->Name(aOutEncoding);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
EncodingUtils::FindEncodingForLabelNoReplacement(const nsACString& aLabel,
|
||||
nsACString& aOutEncoding)
|
||||
{
|
||||
auto encoding = Encoding::ForLabelNoReplacement(aLabel);
|
||||
if (!encoding) {
|
||||
aOutEncoding.Truncate();
|
||||
return false;
|
||||
}
|
||||
encoding->Name(aOutEncoding);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
EncodingUtils::IsAsciiCompatible(const nsACString& aPreferredName)
|
||||
{
|
||||
// HZ and UTF-7 are no longer in mozilla-central, but keeping them here
|
||||
// just in case for the benefit of comm-central.
|
||||
return !(aPreferredName.LowerCaseEqualsLiteral("utf-16") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-16be") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-16le") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("replacement") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("hz-gb-2312") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-7") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("x-imap4-modified-utf7"));
|
||||
}
|
||||
|
||||
UniquePtr<Decoder>
|
||||
EncodingUtils::DecoderForEncoding(const nsACString& aEncoding)
|
||||
{
|
||||
return Encoding::ForName(aEncoding)->NewDecoderWithBOMRemoval();
|
||||
}
|
||||
|
||||
UniquePtr<Encoder>
|
||||
EncodingUtils::EncoderForEncoding(const nsACString& aEncoding)
|
||||
{
|
||||
return Encoding::ForName(aEncoding)->NewEncoder();
|
||||
}
|
||||
|
||||
void
|
||||
EncodingUtils::LangGroupForEncoding(const nsACString& aEncoding,
|
||||
nsACString& aOutGroup)
|
||||
{
|
||||
if (NS_FAILED(nsUConvPropertySearch::SearchPropertyValue(
|
||||
encodingsGroups, ArrayLength(encodingsGroups), aEncoding, aOutGroup))) {
|
||||
aOutGroup.AssignLiteral("x-unicode");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -1,167 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_encodingutils_h_
|
||||
#define mozilla_dom_encodingutils_h_
|
||||
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class EncodingUtils
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Implements get an encoding algorithm from Encoding spec.
|
||||
* http://encoding.spec.whatwg.org/#concept-encoding-get
|
||||
* Given a label, this function returns the corresponding encoding or a
|
||||
* false.
|
||||
* The returned name may not be lowercased due to compatibility with
|
||||
* our internal implementations.
|
||||
*
|
||||
* @deprecated Use mozilla::Encoding::ForLabel() in new code.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1369025
|
||||
*
|
||||
* @param aLabel, incoming label describing charset to be decoded.
|
||||
* @param aOutEncoding, returning corresponding encoding for label.
|
||||
* @return false if no encoding was found for label.
|
||||
* true if valid encoding found.
|
||||
*/
|
||||
static bool FindEncodingForLabel(const nsACString& aLabel,
|
||||
nsACString& aOutEncoding);
|
||||
|
||||
static bool FindEncodingForLabel(const nsAString& aLabel,
|
||||
nsACString& aOutEncoding)
|
||||
{
|
||||
return FindEncodingForLabel(NS_ConvertUTF16toUTF8(aLabel), aOutEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like FindEncodingForLabel() except labels that map to "replacement"
|
||||
* are treated as unknown.
|
||||
*
|
||||
* @deprecated Use mozilla::Encoding::ForLabelNoReplacement() in new code.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1369025
|
||||
*
|
||||
* @param aLabel, incoming label describing charset to be decoded.
|
||||
* @param aOutEncoding, returning corresponding encoding for label.
|
||||
* @return false if no encoding was found for label.
|
||||
* true if valid encoding found.
|
||||
*/
|
||||
static bool FindEncodingForLabelNoReplacement(const nsACString& aLabel,
|
||||
nsACString& aOutEncoding);
|
||||
|
||||
static bool FindEncodingForLabelNoReplacement(const nsAString& aLabel,
|
||||
nsACString& aOutEncoding)
|
||||
{
|
||||
return FindEncodingForLabelNoReplacement(NS_ConvertUTF16toUTF8(aLabel),
|
||||
aOutEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove any leading and trailing space characters, following the
|
||||
* definition of space characters from Encoding spec.
|
||||
* http://encoding.spec.whatwg.org/#terminology
|
||||
* Note that nsAString::StripWhitespace() doesn't exactly match the
|
||||
* definition. It also removes all matching chars in the string,
|
||||
* not just leading and trailing.
|
||||
*
|
||||
* @param aString, string to be trimmed.
|
||||
*/
|
||||
template<class T>
|
||||
static void TrimSpaceCharacters(T& aString)
|
||||
{
|
||||
aString.Trim(" \t\n\f\r");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is the encoding is ASCII-compatible in the sense that Basic Latin
|
||||
* encodes to ASCII bytes. (The reverse may not be true!)
|
||||
*
|
||||
* @param aPreferredName a preferred encoding label
|
||||
* @return whether the encoding is ASCII-compatible
|
||||
*/
|
||||
static bool IsAsciiCompatible(const nsACString& aPreferredName);
|
||||
|
||||
/**
|
||||
* Instantiates a decoder for an encoding. The input must be a
|
||||
* Gecko-canonical encoding name.
|
||||
*
|
||||
* @deprecated Use mozilla::Encoding::NewDecoderWithBOMRemoval()
|
||||
* (or more appropriate variant) in new code.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1369032
|
||||
*
|
||||
* @param aEncoding a Gecko-canonical encoding name
|
||||
* @return a decoder
|
||||
*/
|
||||
static UniquePtr<Decoder> DecoderForEncoding(const char* aEncoding)
|
||||
{
|
||||
nsDependentCString encoding(aEncoding);
|
||||
return DecoderForEncoding(encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a decoder for an encoding. The input must be a
|
||||
*
|
||||
* @deprecated Use mozilla::Encoding::NewDecoderWithBOMRemoval()
|
||||
* (or more appropriate variant) in new code.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1369032
|
||||
*
|
||||
* Gecko-canonical encoding name
|
||||
* @param aEncoding a Gecko-canonical encoding name
|
||||
* @return a decoder
|
||||
*/
|
||||
static UniquePtr<Decoder> DecoderForEncoding(const nsACString& aEncoding);
|
||||
|
||||
/**
|
||||
* Instantiates an encoder for an encoding. The input must be a
|
||||
*
|
||||
* @deprecated Use mozilla::Encoding::NewEncoder() in new code.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1369032
|
||||
*
|
||||
* Gecko-canonical encoding name.
|
||||
* @param aEncoding a Gecko-canonical encoding name
|
||||
* @return an encoder
|
||||
*/
|
||||
static UniquePtr<Encoder> EncoderForEncoding(const char* aEncoding)
|
||||
{
|
||||
nsDependentCString encoding(aEncoding);
|
||||
return EncoderForEncoding(encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates an encoder for an encoding. The input must be a
|
||||
* Gecko-canonical encoding name.
|
||||
*
|
||||
* @deprecated Use mozilla::Encoding::NewEncoder() in new code.
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1369032
|
||||
*
|
||||
* @param aEncoding a Gecko-canonical encoding name
|
||||
* @return an encoder
|
||||
*/
|
||||
static UniquePtr<Encoder> EncoderForEncoding(const nsACString& aEncoding);
|
||||
|
||||
/**
|
||||
* Finds a Gecko language group string (e.g. x-western) for a Gecko-canonical
|
||||
* encoding name.
|
||||
*
|
||||
* @param aEncoding, incoming label describing charset to be decoded.
|
||||
* @param aOutGroup, returning corresponding language group.
|
||||
*/
|
||||
static void LangGroupForEncoding(const nsACString& aEncoding,
|
||||
nsACString& aOutGroup);
|
||||
|
||||
private:
|
||||
EncodingUtils() = delete;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_encodingutils_h_
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
#include "mozilla/dom/FallbackEncoding.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "nsUConvPropertySearch.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/intl/LocaleService.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/intl/LocaleService.h"
|
||||
#include "nsUConvPropertySearch.h"
|
||||
|
||||
using mozilla::intl::LocaleService;
|
||||
|
||||
|
@ -53,10 +53,12 @@ FallbackEncoding::Get(nsACString& aFallback)
|
|||
Preferences::GetCString("intl.charset.fallback.override");
|
||||
// Don't let the user break things by setting the override to unreasonable
|
||||
// values via about:config
|
||||
if (!EncodingUtils::FindEncodingForLabel(override, mFallback) ||
|
||||
!EncodingUtils::IsAsciiCompatible(mFallback) ||
|
||||
mFallback.EqualsLiteral("UTF-8")) {
|
||||
const Encoding* encoding = Encoding::ForLabel(override);
|
||||
if (!encoding || !encoding->IsAsciiCompatible() ||
|
||||
encoding == UTF_8_ENCODING) {
|
||||
mFallback.Truncate();
|
||||
} else {
|
||||
encoding->Name(mFallback);
|
||||
}
|
||||
|
||||
if (!mFallback.IsEmpty()) {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/TextDecoder.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include <stdint.h>
|
||||
|
@ -20,30 +20,31 @@ void
|
|||
TextDecoder::Init(const nsAString& aLabel, const bool aFatal,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsAutoCString encoding;
|
||||
// Let encoding be the result of getting an encoding from label.
|
||||
// If encoding is failure or replacement, throw a RangeError
|
||||
// (https://encoding.spec.whatwg.org/#dom-textdecoder).
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(aLabel, encoding)) {
|
||||
const Encoding* encoding = Encoding::ForLabelNoReplacement(aLabel);
|
||||
if (!encoding) {
|
||||
nsAutoString label(aLabel);
|
||||
EncodingUtils::TrimSpaceCharacters(label);
|
||||
label.Trim(" \t\n\f\r");
|
||||
aRv.ThrowRangeError<MSG_ENCODING_NOT_SUPPORTED>(label);
|
||||
return;
|
||||
}
|
||||
InitWithEncoding(encoding, aFatal);
|
||||
InitWithEncoding(WrapNotNull(encoding), aFatal);
|
||||
}
|
||||
|
||||
void
|
||||
TextDecoder::InitWithEncoding(const nsACString& aEncoding, const bool aFatal)
|
||||
TextDecoder::InitWithEncoding(NotNull<const Encoding*> aEncoding,
|
||||
const bool aFatal)
|
||||
{
|
||||
mEncoding = aEncoding;
|
||||
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;
|
||||
|
||||
// Create a decoder object for mEncoding.
|
||||
mDecoder = EncodingUtils::DecoderForEncoding(mEncoding);
|
||||
mDecoder = aEncoding->NewDecoderWithBOMRemoval();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -70,11 +70,12 @@ public:
|
|||
* Performs initialization with a Gecko-canonical encoding name (as opposed
|
||||
* to a label.)
|
||||
*
|
||||
* @param aEncoding A Gecko-canonical encoding name
|
||||
* @param aEncoding An Encoding object
|
||||
* @param aFatal indicates whether to throw an 'EncodingError'
|
||||
* exception or not when decoding.
|
||||
*/
|
||||
void InitWithEncoding(const nsACString& aEncoding, const bool aFatal);
|
||||
void InitWithEncoding(NotNull<const Encoding*> aEncoding,
|
||||
const bool aFatal);
|
||||
|
||||
/**
|
||||
* Return the encoding name.
|
||||
|
|
|
@ -8,14 +8,12 @@ with Files("**"):
|
|||
BUG_COMPONENT = ("Core", "Internationalization")
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'EncodingUtils.h',
|
||||
'FallbackEncoding.h',
|
||||
'TextDecoder.h',
|
||||
'TextEncoder.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'EncodingUtils.cpp',
|
||||
'FallbackEncoding.cpp',
|
||||
'TextDecoder.cpp',
|
||||
'TextEncoder.cpp',
|
||||
|
@ -29,7 +27,6 @@ LOCAL_INCLUDES += [
|
|||
props2arrays = '/intl/locale/props2arrays.py'
|
||||
prefixes = (
|
||||
'domainsfallbacks',
|
||||
'encodingsgroups',
|
||||
'labelsencodings',
|
||||
'localesfallbacks',
|
||||
'nonparticipatingdomains',
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "BodyExtractor.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FormData.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
|
|
|
@ -15,11 +15,10 @@
|
|||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FileReaderBinding.h"
|
||||
#include "mozilla/dom/ProgressEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsError.h"
|
||||
|
@ -451,37 +450,33 @@ FileReader::GetAsText(Blob *aBlob,
|
|||
uint32_t aDataLen,
|
||||
nsAString& aResult)
|
||||
{
|
||||
// The BOM sniffing is baked into the "decode" part of the Encoding
|
||||
// Standard, which the File API references.
|
||||
nsAutoCString encoding;
|
||||
if (!nsContentUtils::CheckForBOM(
|
||||
reinterpret_cast<const unsigned char *>(aFileData),
|
||||
aDataLen,
|
||||
encoding)) {
|
||||
// BOM sniffing failed. Try the API argument.
|
||||
if (!EncodingUtils::FindEncodingForLabel(aCharset,
|
||||
encoding)) {
|
||||
// API argument failed. Try the type property of the blob.
|
||||
nsAutoString type16;
|
||||
aBlob->GetType(type16);
|
||||
NS_ConvertUTF16toUTF8 type(type16);
|
||||
nsAutoCString specifiedCharset;
|
||||
bool haveCharset;
|
||||
int32_t charsetStart, charsetEnd;
|
||||
NS_ExtractCharsetFromContentType(type,
|
||||
specifiedCharset,
|
||||
&haveCharset,
|
||||
&charsetStart,
|
||||
&charsetEnd);
|
||||
if (!EncodingUtils::FindEncodingForLabel(specifiedCharset, encoding)) {
|
||||
// Type property failed. Use UTF-8.
|
||||
encoding.AssignLiteral("UTF-8");
|
||||
}
|
||||
// Try the API argument.
|
||||
const Encoding* encoding = Encoding::ForLabel(aCharset);
|
||||
if (!encoding) {
|
||||
// API argument failed. Try the type property of the blob.
|
||||
nsAutoString type16;
|
||||
aBlob->GetType(type16);
|
||||
NS_ConvertUTF16toUTF8 type(type16);
|
||||
nsAutoCString specifiedCharset;
|
||||
bool haveCharset;
|
||||
int32_t charsetStart, charsetEnd;
|
||||
NS_ExtractCharsetFromContentType(type,
|
||||
specifiedCharset,
|
||||
&haveCharset,
|
||||
&charsetStart,
|
||||
&charsetEnd);
|
||||
encoding = Encoding::ForLabel(specifiedCharset);
|
||||
if (!encoding) {
|
||||
// Type property failed. Use UTF-8.
|
||||
encoding = UTF_8_ENCODING;
|
||||
}
|
||||
}
|
||||
|
||||
return nsContentUtils::ConvertStringFromEncoding(
|
||||
encoding, aFileData, aDataLen, aResult);
|
||||
auto data = MakeSpan(reinterpret_cast<const uint8_t*>(aFileData),
|
||||
aDataLen);
|
||||
nsresult rv;
|
||||
Tie(rv, encoding) = encoding->Decode(data, aResult);
|
||||
return NS_FAILED(rv) ? rv : NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "mozilla/dom/Directory.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -1873,8 +1873,12 @@ HTMLInputElement::SetValue(const nsAString& aValue, CallerType aCallerType,
|
|||
nsAutoString currentValue;
|
||||
GetValue(currentValue, aCallerType);
|
||||
|
||||
// Some types sanitize value, so GetValue doesn't return pure
|
||||
// previous value correctly.
|
||||
nsresult rv =
|
||||
SetValueInternal(aValue,
|
||||
(IsExperimentalMobileType(mType) || IsDateTimeInputType(mType)) ?
|
||||
nullptr : ¤tValue,
|
||||
nsTextEditorState::eSetValue_ByContent |
|
||||
nsTextEditorState::eSetValue_Notify |
|
||||
nsTextEditorState::eSetValue_MoveCursorToEndIfValueChanged);
|
||||
|
@ -3032,7 +3036,9 @@ HTMLInputElement::UpdateFileList()
|
|||
}
|
||||
|
||||
nsresult
|
||||
HTMLInputElement::SetValueInternal(const nsAString& aValue, uint32_t aFlags)
|
||||
HTMLInputElement::SetValueInternal(const nsAString& aValue,
|
||||
const nsAString* aOldValue,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
NS_PRECONDITION(GetValueMode() != VALUE_MODE_FILENAME,
|
||||
"Don't call SetValueInternal for file inputs");
|
||||
|
@ -3056,7 +3062,7 @@ HTMLInputElement::SetValueInternal(const nsAString& aValue, uint32_t aFlags)
|
|||
}
|
||||
|
||||
if (IsSingleLineTextControl(false)) {
|
||||
if (!mInputData.mState->SetValue(value, aFlags)) {
|
||||
if (!mInputData.mState->SetValue(value, aOldValue, aFlags)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
if (mType == NS_FORM_INPUT_EMAIL) {
|
||||
|
|
|
@ -942,9 +942,19 @@ protected:
|
|||
* Setting the value.
|
||||
*
|
||||
* @param aValue String to set.
|
||||
* @param aOldValue Previous value before setting aValue.
|
||||
If previous value is unknown, aOldValue can be nullptr.
|
||||
* @param aFlags See nsTextEditorState::SetValueFlags.
|
||||
*/
|
||||
nsresult SetValueInternal(const nsAString& aValue, uint32_t aFlags);
|
||||
nsresult SetValueInternal(const nsAString& aValue,
|
||||
const nsAString* aOldValue,
|
||||
uint32_t aFlags);
|
||||
|
||||
nsresult SetValueInternal(const nsAString& aValue,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
return SetValueInternal(aValue, nullptr, aFlags);
|
||||
}
|
||||
|
||||
// Generic getter for the value that doesn't do experimental control type
|
||||
// sanitization.
|
||||
|
|
|
@ -82,8 +82,8 @@
|
|||
//AHMED 12-2
|
||||
#include "nsBidiUtils.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/FallbackEncoding.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "nsIEditingSession.h"
|
||||
#include "nsIEditor.h"
|
||||
|
@ -150,6 +150,20 @@ static bool ConvertToMidasInternalCommand(const nsAString & inCommandID,
|
|||
// =
|
||||
// ==================================================================
|
||||
|
||||
static bool
|
||||
IsAsciiCompatible(const nsACString& aPreferredName)
|
||||
{
|
||||
// HZ and UTF-7 are no longer in mozilla-central, but keeping them here
|
||||
// just in case for the benefit of comm-central.
|
||||
return !(aPreferredName.LowerCaseEqualsLiteral("utf-16") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-16be") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-16le") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("replacement") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("hz-gb-2312") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-7") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("x-imap4-modified-utf7"));
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult, bool aLoadedAsData)
|
||||
{
|
||||
|
@ -286,7 +300,7 @@ nsHTMLDocument::TryHintCharset(nsIContentViewer* aCv,
|
|||
if(requestCharsetSource <= aCharsetSource)
|
||||
return;
|
||||
|
||||
if(NS_SUCCEEDED(rv) && EncodingUtils::IsAsciiCompatible(requestCharset)) {
|
||||
if(NS_SUCCEEDED(rv) && IsAsciiCompatible(requestCharset)) {
|
||||
aCharsetSource = requestCharsetSource;
|
||||
aCharset = requestCharset;
|
||||
|
||||
|
@ -310,7 +324,7 @@ nsHTMLDocument::TryUserForcedCharset(nsIContentViewer* aCv,
|
|||
return;
|
||||
|
||||
// mCharacterSet not updated yet for channel, so check aCharset, too.
|
||||
if (WillIgnoreCharsetOverride() || !EncodingUtils::IsAsciiCompatible(aCharset)) {
|
||||
if (WillIgnoreCharsetOverride() || !IsAsciiCompatible(aCharset)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -322,7 +336,7 @@ nsHTMLDocument::TryUserForcedCharset(nsIContentViewer* aCv,
|
|||
|
||||
if(NS_SUCCEEDED(rv) &&
|
||||
!forceCharsetFromDocShell.IsEmpty() &&
|
||||
EncodingUtils::IsAsciiCompatible(forceCharsetFromDocShell)) {
|
||||
IsAsciiCompatible(forceCharsetFromDocShell)) {
|
||||
aCharset = forceCharsetFromDocShell;
|
||||
aCharsetSource = kCharsetFromUserForced;
|
||||
return;
|
||||
|
@ -334,7 +348,7 @@ nsHTMLDocument::TryUserForcedCharset(nsIContentViewer* aCv,
|
|||
rv = aDocShell->GetForcedCharset(charset);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !charset.IsEmpty()) {
|
||||
if (!EncodingUtils::IsAsciiCompatible(charset)) {
|
||||
if (!IsAsciiCompatible(charset)) {
|
||||
return;
|
||||
}
|
||||
aCharset = charset;
|
||||
|
@ -360,20 +374,24 @@ nsHTMLDocument::TryCacheCharset(nsICachingChannel* aCachingChannel,
|
|||
if (NS_FAILED(rv) || cachedCharset.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
// The canonical names changed, so the cache may have an old name.
|
||||
if (!cachedCharset.EqualsLiteral("replacement")) {
|
||||
if (!EncodingUtils::FindEncodingForLabel(cachedCharset, cachedCharset)) {
|
||||
return;
|
||||
}
|
||||
// The replacement encoding is not ASCII-compatible.
|
||||
if (cachedCharset.EqualsLiteral("replacement")) {
|
||||
return;
|
||||
}
|
||||
// Check EncodingUtils::IsAsciiCompatible() even in the cache case, because the value
|
||||
// The canonical names changed, so the cache may have an old name.
|
||||
const Encoding* encoding = Encoding::ForLabel(cachedCharset);
|
||||
if (!encoding) {
|
||||
return;
|
||||
}
|
||||
// Check IsAsciiCompatible() even in the cache case, because the value
|
||||
// might be stale and in the case of a stale charset that is not a rough
|
||||
// ASCII superset, the parser has no way to recover.
|
||||
if (EncodingUtils::IsAsciiCompatible(cachedCharset))
|
||||
{
|
||||
aCharset = cachedCharset;
|
||||
aCharsetSource = kCharsetFromCache;
|
||||
if (!encoding->IsAsciiCompatible() && encoding != ISO_2022_JP_ENCODING) {
|
||||
return;
|
||||
}
|
||||
encoding->Name(cachedCharset);
|
||||
aCharset = cachedCharset;
|
||||
aCharsetSource = kCharsetFromCache;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -400,8 +418,8 @@ nsHTMLDocument::TryParentCharset(nsIDocShell* aDocShell,
|
|||
if (kCharsetFromParentForced == parentSource ||
|
||||
kCharsetFromUserForced == parentSource) {
|
||||
if (WillIgnoreCharsetOverride() ||
|
||||
!EncodingUtils::IsAsciiCompatible(aCharset) || // if channel said UTF-16
|
||||
!EncodingUtils::IsAsciiCompatible(parentCharset)) {
|
||||
!IsAsciiCompatible(aCharset) || // if channel said UTF-16
|
||||
!IsAsciiCompatible(parentCharset)) {
|
||||
return;
|
||||
}
|
||||
aCharset.Assign(parentCharset);
|
||||
|
@ -416,7 +434,7 @@ nsHTMLDocument::TryParentCharset(nsIDocShell* aDocShell,
|
|||
if (kCharsetFromCache <= parentSource) {
|
||||
// Make sure that's OK
|
||||
if (!NodePrincipal()->Equals(parentPrincipal) ||
|
||||
!EncodingUtils::IsAsciiCompatible(parentCharset)) {
|
||||
!IsAsciiCompatible(parentCharset)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1358,8 +1376,7 @@ nsHTMLDocument::GetCookie(nsAString& aCookie, ErrorResult& rv)
|
|||
service->GetCookieString(codebaseURI, channel, getter_Copies(cookie));
|
||||
// CopyUTF8toUTF16 doesn't handle error
|
||||
// because it assumes that the input is valid.
|
||||
nsContentUtils::ConvertStringFromEncoding(NS_LITERAL_CSTRING("UTF-8"),
|
||||
cookie, aCookie);
|
||||
UTF_8_ENCODING->DecodeWithoutBOMHandling(cookie, aCookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3725,7 +3742,7 @@ nsHTMLDocument::WillIgnoreCharsetOverride()
|
|||
if (mCharacterSetSource >= kCharsetFromByteOrderMark) {
|
||||
return true;
|
||||
}
|
||||
if (!EncodingUtils::IsAsciiCompatible(mCharacterSet)) {
|
||||
if (!IsAsciiCompatible(mCharacterSet)) {
|
||||
return true;
|
||||
}
|
||||
nsCOMPtr<nsIWyciwygChannel> wyciwyg = do_QueryInterface(mChannel);
|
||||
|
|
|
@ -2492,7 +2492,8 @@ nsTextEditorState::GetValue(nsAString& aValue, bool aIgnoreWrap) const
|
|||
}
|
||||
|
||||
bool
|
||||
nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
|
||||
nsTextEditorState::SetValue(const nsAString& aValue, const nsAString* aOldValue,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
nsAutoString newValue(aValue);
|
||||
|
||||
|
@ -2505,6 +2506,9 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
|
|||
// mIsCommittingComposition is set false. See below.
|
||||
if (mIsCommittingComposition) {
|
||||
mValueBeingSet = aValue;
|
||||
// GetValue doesn't return current text frame's content during committing.
|
||||
// So we cannot trust this old value
|
||||
aOldValue = nullptr;
|
||||
}
|
||||
|
||||
// Note that if this may be called during reframe of the editor. In such
|
||||
|
@ -2525,7 +2529,15 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
|
|||
// If setting value won't change current value, we shouldn't commit
|
||||
// composition for compatibility with the other browsers.
|
||||
nsAutoString currentValue;
|
||||
mBoundFrame->GetText(currentValue);
|
||||
if (aOldValue) {
|
||||
#ifdef DEBUG
|
||||
mBoundFrame->GetText(currentValue);
|
||||
MOZ_ASSERT(currentValue.Equals(*aOldValue));
|
||||
#endif
|
||||
currentValue.Assign(*aOldValue);
|
||||
} else {
|
||||
mBoundFrame->GetText(currentValue);
|
||||
}
|
||||
if (newValue == currentValue) {
|
||||
// Note that in this case, we shouldn't fire any events with setting
|
||||
// value because event handlers may try to set value recursively but
|
||||
|
@ -2533,6 +2545,9 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
|
|||
// script (see below).
|
||||
return true;
|
||||
}
|
||||
// IME might commit composition, then change value, so we cannot
|
||||
// trust old value from parameter.
|
||||
aOldValue = nullptr;
|
||||
}
|
||||
// If there is composition, need to commit composition first because
|
||||
// other browsers do that.
|
||||
|
@ -2593,7 +2608,15 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags)
|
|||
#endif
|
||||
|
||||
nsAutoString currentValue;
|
||||
mBoundFrame->GetText(currentValue);
|
||||
if (aOldValue) {
|
||||
#ifdef DEBUG
|
||||
mBoundFrame->GetText(currentValue);
|
||||
MOZ_ASSERT(currentValue.Equals(*aOldValue));
|
||||
#endif
|
||||
currentValue.Assign(*aOldValue);
|
||||
} else {
|
||||
mBoundFrame->GetText(currentValue);
|
||||
}
|
||||
|
||||
AutoWeakFrame weakFrame(mBoundFrame);
|
||||
|
||||
|
|
|
@ -179,7 +179,14 @@ public:
|
|||
// not changed the cursor won't move.
|
||||
eSetValue_MoveCursorToEndIfValueChanged = 1 << 3,
|
||||
};
|
||||
MOZ_MUST_USE bool SetValue(const nsAString& aValue, uint32_t aFlags);
|
||||
MOZ_MUST_USE bool SetValue(const nsAString& aValue,
|
||||
const nsAString* aOldValue,
|
||||
uint32_t aFlags);
|
||||
MOZ_MUST_USE bool SetValue(const nsAString& aValue,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
return SetValue(aValue, nullptr, aFlags);
|
||||
}
|
||||
void GetValue(nsAString& aValue, bool aIgnoreWrap) const;
|
||||
bool HasNonEmptyValue();
|
||||
// The following methods are for textarea element to use whether default
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseFileChild.h"
|
||||
#include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
|
||||
#include "mozilla/dom/ipc/PendingIPCBlobChild.h"
|
||||
#include "mozilla/dom/IPCBlobUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/TaskQueue.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -1330,28 +1330,22 @@ private:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoCString encoding;
|
||||
// The BOM sniffing is baked into the "decode" part of the Encoding
|
||||
// Standard, which the File API references.
|
||||
if (!nsContentUtils::CheckForBOM(
|
||||
reinterpret_cast<const unsigned char *>(data.get()),
|
||||
data.Length(),
|
||||
encoding)) {
|
||||
// BOM sniffing failed. Try the API argument.
|
||||
if (!EncodingUtils::FindEncodingForLabel(mFileRequest->GetEncoding(),
|
||||
encoding)) {
|
||||
// API argument failed. Since we are dealing with a file system file,
|
||||
// we don't have a meaningful type attribute for the blob available,
|
||||
// so proceeding to the next step, which is defaulting to UTF-8.
|
||||
encoding.AssignLiteral("UTF-8");
|
||||
}
|
||||
// Try the API argument.
|
||||
const Encoding* encoding =
|
||||
Encoding::ForLabel(mFileRequest->GetEncoding());
|
||||
if (!encoding) {
|
||||
// API argument failed. Since we are dealing with a file system file,
|
||||
// we don't have a meaningful type attribute for the blob available,
|
||||
// so proceeding to the next step, which is defaulting to UTF-8.
|
||||
encoding = UTF_8_ENCODING;
|
||||
}
|
||||
|
||||
nsString tmpString;
|
||||
rv = nsContentUtils::ConvertStringFromEncoding(encoding, data, tmpString);
|
||||
Tie(rv, encoding) = encoding->Decode(data, tmpString);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR;
|
||||
}
|
||||
rv = NS_OK;
|
||||
|
||||
if (NS_WARN_IF(!xpc::StringToJsval(aCx, tmpString, aResult))) {
|
||||
return NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR;
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "mozilla/CDMProxy.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/EMEUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "GMPUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "psshparser/PsshParser.h"
|
||||
|
@ -197,7 +197,7 @@ ValidateInitData(const nsTArray<uint8_t>& aInitData, const nsAString& aInitDataT
|
|||
mozilla::dom::KeyIdsInitData keyIds;
|
||||
nsString json;
|
||||
nsDependentCSubstring raw(reinterpret_cast<const char*>(aInitData.Elements()), aInitData.Length());
|
||||
if (NS_FAILED(nsContentUtils::ConvertStringFromEncoding(NS_LITERAL_CSTRING("UTF-8"), raw, json))) {
|
||||
if (NS_FAILED(UTF_8_ENCODING->DecodeWithBOMRemoval(raw, json))) {
|
||||
return false;
|
||||
}
|
||||
if (!keyIds.Init(json)) {
|
||||
|
|
|
@ -31,7 +31,7 @@ function write_registry(version, info) {
|
|||
var charset = "UTF-8"; // Can be any character encoding name that Mozilla supports
|
||||
var os = Cc["@mozilla.org/intl/converter-output-stream;1"].
|
||||
createInstance(Ci.nsIConverterOutputStream);
|
||||
os.init(foStream, charset, 0, 0x0000);
|
||||
os.init(foStream, charset);
|
||||
|
||||
os.writeString(header);
|
||||
os.writeString(info);
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "nsSandboxFlags.h"
|
||||
#include "nsContentTypeParser.h"
|
||||
#include "nsINetworkPredictor.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/ConsoleReportCollector.h"
|
||||
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
|
|
|
@ -9,9 +9,8 @@
|
|||
#include "jsfriendapi.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/dom/FileReaderSyncBinding.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
@ -142,8 +141,6 @@ FileReaderSync::ReadAsText(Blob& aBlob,
|
|||
return;
|
||||
}
|
||||
|
||||
nsAutoCString encoding;
|
||||
|
||||
nsCString sniffBuf;
|
||||
if (!sniffBuf.SetLength(3, fallible)) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -162,30 +159,26 @@ FileReaderSync::ReadAsText(Blob& aBlob,
|
|||
return;
|
||||
}
|
||||
|
||||
// The BOM sniffing is baked into the "decode" part of the Encoding
|
||||
// Standard, which the File API references.
|
||||
if (!nsContentUtils::CheckForBOM((const unsigned char*)sniffBuf.BeginReading(),
|
||||
numRead, encoding)) {
|
||||
// BOM sniffing failed. Try the API argument.
|
||||
if (!aEncoding.WasPassed() ||
|
||||
!EncodingUtils::FindEncodingForLabel(aEncoding.Value(),
|
||||
encoding)) {
|
||||
// API argument failed. Try the type property of the blob.
|
||||
nsAutoString type16;
|
||||
aBlob.GetType(type16);
|
||||
NS_ConvertUTF16toUTF8 type(type16);
|
||||
nsAutoCString specifiedCharset;
|
||||
bool haveCharset;
|
||||
int32_t charsetStart, charsetEnd;
|
||||
NS_ExtractCharsetFromContentType(type,
|
||||
specifiedCharset,
|
||||
&haveCharset,
|
||||
&charsetStart,
|
||||
&charsetEnd);
|
||||
if (!EncodingUtils::FindEncodingForLabel(specifiedCharset, encoding)) {
|
||||
// Type property failed. Use UTF-8.
|
||||
encoding.AssignLiteral("UTF-8");
|
||||
}
|
||||
// Try the API argument.
|
||||
const Encoding* encoding = aEncoding.WasPassed() ?
|
||||
Encoding::ForLabel(aEncoding.Value()) : nullptr;
|
||||
if (!encoding) {
|
||||
// API argument failed. Try the type property of the blob.
|
||||
nsAutoString type16;
|
||||
aBlob.GetType(type16);
|
||||
NS_ConvertUTF16toUTF8 type(type16);
|
||||
nsAutoCString specifiedCharset;
|
||||
bool haveCharset;
|
||||
int32_t charsetStart, charsetEnd;
|
||||
NS_ExtractCharsetFromContentType(type,
|
||||
specifiedCharset,
|
||||
&haveCharset,
|
||||
&charsetStart,
|
||||
&charsetEnd);
|
||||
encoding = Encoding::ForLabel(specifiedCharset);
|
||||
if (!encoding) {
|
||||
// Type property failed. Use UTF-8.
|
||||
encoding = UTF_8_ENCODING;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,7 +224,9 @@ FileReaderSync::ReadAsText(Blob& aBlob,
|
|||
}
|
||||
}
|
||||
|
||||
aRv = ConvertStream(multiplexStream, encoding.get(), aResult);
|
||||
nsAutoCString charset;
|
||||
encoding->Name(charset);
|
||||
aRv = ConvertStream(multiplexStream, charset.get(), aResult);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "mozilla/dom/BodyUtil.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/DOMExceptionBinding.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/FetchEventBinding.h"
|
||||
#include "mozilla/dom/MessagePort.h"
|
||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "mozilla/dom/XMLDocument.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
|
@ -76,7 +77,6 @@
|
|||
#include "mozilla/Telemetry.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/XMLHttpRequestBinding.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "MultipartBlobImpl.h"
|
||||
|
@ -503,22 +503,24 @@ XMLHttpRequestMainThread::DetectCharset()
|
|||
}
|
||||
|
||||
nsAutoCString charsetVal;
|
||||
const Encoding* encoding;
|
||||
bool ok = mChannel &&
|
||||
NS_SUCCEEDED(mChannel->GetContentCharset(charsetVal)) &&
|
||||
EncodingUtils::FindEncodingForLabel(charsetVal, mResponseCharset);
|
||||
if (!ok || mResponseCharset.IsEmpty()) {
|
||||
(encoding = Encoding::ForLabel(charsetVal));
|
||||
if (!ok) {
|
||||
// MS documentation states UTF-8 is default for responseText
|
||||
mResponseCharset.AssignLiteral("UTF-8");
|
||||
encoding = UTF_8_ENCODING;
|
||||
}
|
||||
|
||||
if (mResponseType == XMLHttpRequestResponseType::Json &&
|
||||
!mResponseCharset.EqualsLiteral("UTF-8")) {
|
||||
encoding != UTF_8_ENCODING) {
|
||||
// The XHR spec says only UTF-8 is supported for responseType == "json"
|
||||
LogMessage("JSONCharsetWarning", GetOwner());
|
||||
mResponseCharset.AssignLiteral("UTF-8");
|
||||
encoding = UTF_8_ENCODING;
|
||||
}
|
||||
|
||||
mDecoder = EncodingUtils::DecoderForEncoding(mResponseCharset);
|
||||
encoding->Name(mResponseCharset);
|
||||
mDecoder = encoding->NewDecoderWithBOMRemoval();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2431,7 +2433,7 @@ XMLHttpRequestMainThread::MatchCharsetAndDecoderToResponseDocument()
|
|||
mResponseCharset = mResponseXML->GetDocumentCharacterSet();
|
||||
TruncateResponseText();
|
||||
mResponseBodyDecodedPos = 0;
|
||||
mDecoder = EncodingUtils::DecoderForEncoding(mResponseCharset);
|
||||
mDecoder = Encoding::ForName(mResponseCharset)->NewDecoderWithBOMRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,10 @@
|
|||
#include "nsError.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::EncodingUtils;
|
||||
using mozilla::net::ReferrerPolicy;
|
||||
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
|
@ -257,18 +256,21 @@ txStylesheetSink::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
|
|||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
|
||||
// check channel's charset...
|
||||
const Encoding* encoding = nullptr;
|
||||
nsAutoCString charsetVal;
|
||||
nsAutoCString charset;
|
||||
if (NS_SUCCEEDED(channel->GetContentCharset(charsetVal))) {
|
||||
if (EncodingUtils::FindEncodingForLabel(charsetVal, charset)) {
|
||||
encoding = Encoding::ForLabel(charsetVal);
|
||||
if (encoding) {
|
||||
charsetSource = kCharsetFromChannel;
|
||||
}
|
||||
}
|
||||
|
||||
if (charset.IsEmpty()) {
|
||||
charset.AssignLiteral("UTF-8");
|
||||
if (!encoding) {
|
||||
encoding = UTF_8_ENCODING;
|
||||
}
|
||||
|
||||
nsAutoCString charset;
|
||||
encoding->Name(charset);
|
||||
mParser->SetDocumentCharset(charset, charsetSource);
|
||||
|
||||
nsAutoCString contentType;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsTextNode.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
|
||||
|
@ -160,11 +160,11 @@ txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
|
|||
|
||||
// Set the charset
|
||||
if (!mOutputFormat.mEncoding.IsEmpty()) {
|
||||
nsAutoCString canonicalCharset;
|
||||
|
||||
if (EncodingUtils::FindEncodingForLabel(mOutputFormat.mEncoding,
|
||||
canonicalCharset)) {
|
||||
const Encoding* encoding = Encoding::ForLabel(mOutputFormat.mEncoding);
|
||||
if (encoding) {
|
||||
mDocument->SetDocumentCharacterSetSource(kCharsetFromOtherComponent);
|
||||
nsAutoCString canonicalCharset;
|
||||
encoding->Name(canonicalCharset);
|
||||
mDocument->SetDocumentCharacterSet(canonicalCharset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/ScriptLoader.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "txXMLUtils.h"
|
||||
#include "nsContentSink.h"
|
||||
|
@ -820,10 +820,11 @@ txMozillaXMLOutput::createResultDocument(const nsSubstring& aName, int32_t aNsID
|
|||
|
||||
// Set the charset
|
||||
if (!mOutputFormat.mEncoding.IsEmpty()) {
|
||||
nsAutoCString canonicalCharset;
|
||||
if (EncodingUtils::FindEncodingForLabel(mOutputFormat.mEncoding,
|
||||
canonicalCharset)) {
|
||||
const Encoding* encoding = Encoding::ForLabel(mOutputFormat.mEncoding);
|
||||
if (encoding) {
|
||||
mDocument->SetDocumentCharacterSetSource(kCharsetFromOtherComponent);
|
||||
nsAutoCString canonicalCharset;
|
||||
encoding->Name(canonicalCharset);
|
||||
mDocument->SetDocumentCharacterSet(canonicalCharset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ add_task(function* do_test() {
|
|||
ostream.init(file, -1, 0o666, 0);
|
||||
let conv = Cc["@mozilla.org/intl/converter-output-stream;1"].
|
||||
createInstance(Ci.nsIConverterOutputStream);
|
||||
conv.init(ostream, "UTF-8", 0, 0);
|
||||
conv.init(ostream, "UTF-8");
|
||||
|
||||
conv.writeString("# this is a comment\n");
|
||||
conv.writeString("\n"); // a blank line!
|
||||
|
|
|
@ -20,7 +20,7 @@ function run_test() {
|
|||
ostream.init(file, 0x02, 0o666, 0);
|
||||
var conv = Cc["@mozilla.org/intl/converter-output-stream;1"].
|
||||
createInstance(Ci.nsIConverterOutputStream);
|
||||
conv.init(ostream, "UTF-8", 0, 0);
|
||||
conv.init(ostream, "UTF-8");
|
||||
for (var i = 0; i < file.fileSize; ++i)
|
||||
conv.writeString("a");
|
||||
conv.close();
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/BinarySearch.h"
|
||||
|
|
|
@ -89,12 +89,18 @@ RESOURCE_FILES += [
|
|||
'language.properties',
|
||||
]
|
||||
|
||||
GENERATED_FILES += [
|
||||
'langGroups.properties.h',
|
||||
]
|
||||
langgroups = GENERATED_FILES['langGroups.properties.h']
|
||||
langgroups.script = 'props2arrays.py'
|
||||
langgroups.inputs = ['langGroups.properties']
|
||||
prefixes = (
|
||||
'encodingsgroups',
|
||||
'langGroups',
|
||||
)
|
||||
|
||||
for prefix in prefixes:
|
||||
input_file = prefix + '.properties'
|
||||
header = prefix + '.properties.h'
|
||||
GENERATED_FILES += [header]
|
||||
props = GENERATED_FILES[header]
|
||||
props.script = 'props2arrays.py'
|
||||
props.inputs = [input_file]
|
||||
|
||||
if CONFIG['ENABLE_TESTS']:
|
||||
DIRS += ['tests/gtest']
|
||||
|
|
|
@ -8,14 +8,17 @@
|
|||
#include "nsUnicharUtils.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/intl/OSPreferences.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/intl/OSPreferences.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::intl::OSPreferences;
|
||||
|
||||
static constexpr nsUConvProp encodingsGroups[] = {
|
||||
#include "encodingsgroups.properties.h"
|
||||
};
|
||||
|
||||
static constexpr nsUConvProp kLangGroups[] = {
|
||||
#include "langGroups.properties.h"
|
||||
};
|
||||
|
@ -46,7 +49,10 @@ already_AddRefed<nsIAtom>
|
|||
nsLanguageAtomService::LookupCharSet(const nsACString& aCharSet)
|
||||
{
|
||||
nsAutoCString group;
|
||||
dom::EncodingUtils::LangGroupForEncoding(aCharSet, group);
|
||||
if (NS_FAILED(nsUConvPropertySearch::SearchPropertyValue(
|
||||
encodingsGroups, ArrayLength(encodingsGroups), aCharSet, group))) {
|
||||
return RefPtr<nsIAtom>(nsGkAtoms::Unicode).forget();
|
||||
}
|
||||
return NS_Atomize(group);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,8 @@
|
|||
#include "nsPlatformCharset.h"
|
||||
#include "prinit.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
using namespace mozilla;
|
||||
|
||||
static constexpr nsUConvProp kUnixCharsets[] = {
|
||||
|
@ -126,11 +125,11 @@ nsPlatformCharset::VerifyCharset(nsCString &aCharset)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(aCharset, encoding)) {
|
||||
const Encoding* encoding = Encoding::ForLabelNoReplacement(aCharset);
|
||||
if (!encoding) {
|
||||
return NS_ERROR_UCONV_NOCONV;
|
||||
}
|
||||
|
||||
aCharset.Assign(encoding);
|
||||
encoding->Name(aCharset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -25,9 +25,7 @@ nsConverterOutputStream::~nsConverterOutputStream()
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsConverterOutputStream::Init(nsIOutputStream* aOutStream,
|
||||
const char* aCharset,
|
||||
uint32_t aBufferSize /* ignored */,
|
||||
char16_t aReplacementChar) /* ignored */
|
||||
const char* aCharset)
|
||||
{
|
||||
NS_PRECONDITION(aOutStream, "Null output stream!");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ function run_test() {
|
|||
|
||||
// Output
|
||||
var outStr = storage.getOutputStream(0);
|
||||
var out = new ConverterOutputStream(outStr, "UTF-8", 1024, 0xFFFD);
|
||||
var out = new ConverterOutputStream(outStr, "UTF-8");
|
||||
out.writeString("Foo.");
|
||||
out.close();
|
||||
out.close(); // This line should not crash. It should just do nothing.
|
||||
|
|
|
@ -69,7 +69,7 @@ function test_utf8_1()
|
|||
for (var i = 0; i < UNICODE_STRINGS.length; i++)
|
||||
{
|
||||
var pipe = Pipe();
|
||||
var conv = new COS(pipe.outputStream, "UTF-8", 1024, 0x0);
|
||||
var conv = new COS(pipe.outputStream, "UTF-8");
|
||||
do_check_true(conv.writeString(UNICODE_STRINGS[i]));
|
||||
conv.close();
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
#include "mozilla/a11y/DocAccessible.h"
|
||||
#endif
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
|
@ -3382,17 +3382,20 @@ nsDocumentViewer::SetForceCharacterSet(const nsACString& aForceCharacterSet)
|
|||
// than a canonical name. However, in case where the input is a canonical
|
||||
// name, "replacement" doesn't survive label resolution. Additionally, the
|
||||
// empty string means no hint.
|
||||
nsAutoCString encoding;
|
||||
const Encoding* encoding = nullptr;
|
||||
if (!aForceCharacterSet.IsEmpty()) {
|
||||
if (aForceCharacterSet.EqualsLiteral("replacement")) {
|
||||
encoding.AssignLiteral("replacement");
|
||||
} else if (!EncodingUtils::FindEncodingForLabel(aForceCharacterSet,
|
||||
encoding)) {
|
||||
encoding = REPLACEMENT_ENCODING;
|
||||
} else if (!(encoding = Encoding::ForLabel(aForceCharacterSet))) {
|
||||
// Reject unknown labels
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
mForceCharacterSet = encoding;
|
||||
if (encoding) {
|
||||
encoding->Name(mForceCharacterSet);
|
||||
} else {
|
||||
mForceCharacterSet.Truncate();
|
||||
}
|
||||
// now set the force char set on all children of mContainer
|
||||
CallChildren(SetChildForceCharacterSet, (void*) &aForceCharacterSet);
|
||||
return NS_OK;
|
||||
|
@ -3449,17 +3452,20 @@ nsDocumentViewer::SetHintCharacterSet(const nsACString& aHintCharacterSet)
|
|||
// than a canonical name. However, in case where the input is a canonical
|
||||
// name, "replacement" doesn't survive label resolution. Additionally, the
|
||||
// empty string means no hint.
|
||||
nsAutoCString encoding;
|
||||
const Encoding* encoding = nullptr;
|
||||
if (!aHintCharacterSet.IsEmpty()) {
|
||||
if (aHintCharacterSet.EqualsLiteral("replacement")) {
|
||||
encoding.AssignLiteral("replacement");
|
||||
} else if (!EncodingUtils::FindEncodingForLabel(aHintCharacterSet,
|
||||
encoding)) {
|
||||
encoding = REPLACEMENT_ENCODING;
|
||||
} else if (!(encoding = Encoding::ForLabel(aHintCharacterSet))) {
|
||||
// Reject unknown labels
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
mHintCharset = encoding;
|
||||
if (encoding) {
|
||||
encoding->Name(mHintCharset);
|
||||
} else {
|
||||
mHintCharset.Truncate();
|
||||
}
|
||||
// now set the hint char set on all children of mContainer
|
||||
CallChildren(SetChildHintCharacterSet, (void*) &aHintCharacterSet);
|
||||
return NS_OK;
|
||||
|
|
|
@ -73,8 +73,7 @@
|
|||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "mozilla/dom/SRICheck.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
using mozilla::dom::EncodingUtils;
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
@ -676,9 +675,12 @@ SheetLoadData::OnDetermineCharset(nsIUnicharStreamLoader* aLoader,
|
|||
|
||||
aCharset.Truncate();
|
||||
|
||||
if (nsContentUtils::CheckForBOM((const unsigned char*)aSegment.BeginReading(),
|
||||
aSegment.Length(),
|
||||
aCharset)) {
|
||||
const Encoding* encoding;
|
||||
size_t bomLength;
|
||||
Tie(encoding, bomLength) = Encoding::ForBOM(aSegment);
|
||||
Unused << bomLength;
|
||||
if (encoding) {
|
||||
encoding->Name(aCharset);
|
||||
// aCharset is now either "UTF-16BE", "UTF-16BE" or "UTF-8"
|
||||
// which will swallow the BOM.
|
||||
mCharset.Assign(aCharset);
|
||||
|
@ -691,7 +693,9 @@ SheetLoadData::OnDetermineCharset(nsIUnicharStreamLoader* aLoader,
|
|||
aLoader->GetChannel(getter_AddRefs(channel));
|
||||
if (channel) {
|
||||
channel->GetContentCharset(specified);
|
||||
if (EncodingUtils::FindEncodingForLabel(specified, aCharset)) {
|
||||
encoding = Encoding::ForLabel(specified);
|
||||
if (encoding) {
|
||||
encoding->Name(aCharset);
|
||||
mCharset.Assign(aCharset);
|
||||
LOG((" Setting from HTTP to: %s", PromiseFlatCString(aCharset).get()));
|
||||
return NS_OK;
|
||||
|
@ -701,9 +705,11 @@ SheetLoadData::OnDetermineCharset(nsIUnicharStreamLoader* aLoader,
|
|||
if (GetCharsetFromData(aSegment.BeginReading(),
|
||||
aSegment.Length(),
|
||||
specified)) {
|
||||
if (EncodingUtils::FindEncodingForLabel(specified, aCharset)) {
|
||||
if (aCharset.EqualsLiteral("UTF-16BE") ||
|
||||
aCharset.EqualsLiteral("UTF-16LE")) {
|
||||
encoding = Encoding::ForLabel(specified);
|
||||
if (encoding) {
|
||||
encoding->Name(aCharset);
|
||||
if (encoding == UTF_16BE_ENCODING ||
|
||||
encoding == UTF_16LE_ENCODING) {
|
||||
// Be consistent with HTML <meta> handling in face of impossibility.
|
||||
// When the @charset rule itself evidently was not UTF-16-encoded,
|
||||
// it saying UTF-16 has to be a lie.
|
||||
|
@ -721,7 +727,9 @@ SheetLoadData::OnDetermineCharset(nsIUnicharStreamLoader* aLoader,
|
|||
if (mOwningElement) {
|
||||
nsAutoString specified16;
|
||||
mOwningElement->GetCharset(specified16);
|
||||
if (EncodingUtils::FindEncodingForLabel(specified16, aCharset)) {
|
||||
encoding = Encoding::ForLabel(specified16);
|
||||
if (encoding) {
|
||||
encoding->Name(aCharset);
|
||||
mCharset.Assign(aCharset);
|
||||
LOG((" Setting from charset attribute to: %s",
|
||||
PromiseFlatCString(aCharset).get()));
|
||||
|
@ -731,7 +739,9 @@ SheetLoadData::OnDetermineCharset(nsIUnicharStreamLoader* aLoader,
|
|||
|
||||
// In the preload case, the value of the charset attribute on <link> comes
|
||||
// in via mCharsetHint instead.
|
||||
if (EncodingUtils::FindEncodingForLabel(mCharsetHint, aCharset)) {
|
||||
encoding = Encoding::ForLabel(mCharsetHint);
|
||||
if (encoding) {
|
||||
encoding->Name(aCharset);
|
||||
mCharset.Assign(aCharset);
|
||||
LOG((" Setting from charset attribute (preload case) to: %s",
|
||||
PromiseFlatCString(aCharset).get()));
|
||||
|
|
|
@ -566,9 +566,8 @@ fn pulse_format_to_cubeb_format(format: pa_sample_format_t) -> cubeb::DeviceFmt
|
|||
PA_SAMPLE_S16BE => cubeb::DEVICE_FMT_S16BE,
|
||||
PA_SAMPLE_FLOAT32LE => cubeb::DEVICE_FMT_F32LE,
|
||||
PA_SAMPLE_FLOAT32BE => cubeb::DEVICE_FMT_F32BE,
|
||||
_ => {
|
||||
panic!("Invalid format");
|
||||
},
|
||||
// Unsupported format, return F32NE
|
||||
_ => cubeb::CUBEB_FMT_F32NE,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -254,20 +254,6 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
|
|||
return new DefaultHttpDataSourceFactory(AppConstants.USER_AGENT_FENNEC_MOBILE, bandwidthMeter);
|
||||
}
|
||||
|
||||
private MediaSource buildMediaSource(Uri uri, String overrideExtension) {
|
||||
if (DEBUG) { Log.d(LOGTAG, "buildMediaSource uri[" + uri + "]" + ", overridedExt[" + overrideExtension + "]"); }
|
||||
int type = Util.inferContentType(TextUtils.isEmpty(overrideExtension)
|
||||
? uri.getLastPathSegment()
|
||||
: "." + overrideExtension);
|
||||
switch (type) {
|
||||
case C.TYPE_HLS:
|
||||
return new HlsMediaSource(uri, mMediaDataSourceFactory, mMainHandler, null);
|
||||
default:
|
||||
mResourceCallbacks.onError(ResourceError.UNSUPPORTED.code());
|
||||
throw new IllegalArgumentException("Unsupported type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
// To make sure that each player has a unique id, GeckoHlsPlayer should be
|
||||
// created only from synchronized APIs in GeckoPlayerFactory.
|
||||
public GeckoHlsPlayer() {
|
||||
|
@ -541,7 +527,11 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
|
|||
|
||||
Uri uri = Uri.parse(url);
|
||||
mMediaDataSourceFactory = buildDataSourceFactory(ctx, BANDWIDTH_METER);
|
||||
mMediaSource = buildMediaSource(uri, null);
|
||||
mMediaSource = new HlsMediaSource(uri, mMediaDataSourceFactory, mMainHandler, null);
|
||||
if (DEBUG) {
|
||||
Log.d(LOGTAG, "Uri is " + uri +
|
||||
", ContentType is " + Util.inferContentType(uri.getLastPathSegment()));
|
||||
}
|
||||
|
||||
mPlayer.prepare(mMediaSource);
|
||||
mIsPlayerInitDone = true;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "nsUnicharStreamLoader.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include <algorithm>
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
// 1024 bytes is specified in
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#charset for HTML; for
|
||||
|
@ -17,7 +17,6 @@
|
|||
#define SNIFFING_BUFFER_SIZE 1024
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsUnicharStreamLoader::Init(nsIUnicharStreamLoaderObserver *aObserver)
|
||||
|
@ -184,15 +183,15 @@ nsUnicharStreamLoader::DetermineCharset()
|
|||
// replacement, since it's not invariant under a second label resolution
|
||||
// operation.
|
||||
if (mCharset.EqualsLiteral("replacement")) {
|
||||
mDecoder = EncodingUtils::DecoderForEncoding(mCharset);
|
||||
mDecoder = REPLACEMENT_ENCODING->NewDecoderWithBOMRemoval();
|
||||
} else {
|
||||
nsAutoCString charset;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(mCharset, charset)) {
|
||||
const Encoding* encoding = Encoding::ForLabelNoReplacement(mCharset);
|
||||
if (!encoding) {
|
||||
// If we got replacement here, the caller was not mozilla::css::Loader
|
||||
// but an extension.
|
||||
return NS_ERROR_UCONV_NOCONV;
|
||||
}
|
||||
mDecoder = EncodingUtils::DecoderForEncoding(charset);
|
||||
mDecoder = encoding->NewDecoderWithBOMRemoval();
|
||||
}
|
||||
|
||||
// Process the data into mBuffer
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
using mozilla::Encoding;
|
||||
|
||||
// static functions declared below are moved from mailnews/mime/src/comi18n.cpp
|
||||
|
||||
|
@ -100,15 +100,14 @@ nsMIMEHeaderParamImpl::DoGetParameter(const nsACString& aHeaderVal,
|
|||
|
||||
if (!aFallbackCharset.IsEmpty())
|
||||
{
|
||||
nsAutoCString charset;
|
||||
EncodingUtils::FindEncodingForLabel(aFallbackCharset, charset);
|
||||
const Encoding* encoding = Encoding::ForLabel(aFallbackCharset);
|
||||
nsAutoCString str2;
|
||||
nsCOMPtr<nsIUTF8ConverterService>
|
||||
cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID));
|
||||
if (cvtUTF8 &&
|
||||
NS_SUCCEEDED(cvtUTF8->ConvertStringToUTF8(str1,
|
||||
PromiseFlatCString(aFallbackCharset).get(), false,
|
||||
!charset.EqualsLiteral("UTF-8"),
|
||||
encoding != UTF_8_ENCODING,
|
||||
1, str2))) {
|
||||
CopyUTF8toUTF16(str2, aResult);
|
||||
return NS_OK;
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "DateTimeFormat.h"
|
||||
#include "nsIndexedToHTML.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
#include "DateTimeFormat.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "mozilla/intl/LocaleService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "netCore.h"
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
void
|
||||
nsHtml5MetaScanner::sniff(nsHtml5ByteReadable* bytes, nsACString& charset)
|
||||
|
@ -27,20 +25,20 @@ nsHtml5MetaScanner::tryCharset(nsHtml5String charset)
|
|||
nsString charset16; // Not Auto, because using it to hold nsStringBuffer*
|
||||
charset.ToString(charset16);
|
||||
CopyUTF16toUTF8(charset16, label);
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabel(label, encoding)) {
|
||||
const mozilla::Encoding* encoding = mozilla::Encoding::ForLabel(label);
|
||||
if (!encoding) {
|
||||
return false;
|
||||
}
|
||||
if (encoding.EqualsLiteral("UTF-16BE") ||
|
||||
encoding.EqualsLiteral("UTF-16LE")) {
|
||||
if (encoding == UTF_16BE_ENCODING ||
|
||||
encoding == UTF_16LE_ENCODING) {
|
||||
mCharset.AssignLiteral("UTF-8");
|
||||
return true;
|
||||
}
|
||||
if (encoding.EqualsLiteral("x-user-defined")) {
|
||||
if (encoding == X_USER_DEFINED_ENCODING) {
|
||||
// WebKit/Blink hack for Indian and Armenian legacy sites
|
||||
mCharset.AssignLiteral("windows-1252");
|
||||
return true;
|
||||
}
|
||||
mCharset.Assign(encoding);
|
||||
encoding->Name(mCharset);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
|
||||
#include "nsHtml5StreamParser.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsHtml5Tokenizer.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
|
@ -29,10 +30,7 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
int32_t nsHtml5StreamParser::sTimerInitialDelay = 120;
|
||||
int32_t nsHtml5StreamParser::sTimerSubsequentDelay = 120;
|
||||
|
@ -255,13 +253,15 @@ nsHtml5StreamParser::Notify(const char* aCharset, nsDetectionConfident aConf)
|
|||
NS_ASSERTION(IsParserThread(), "Wrong thread!");
|
||||
if (aConf == eBestAnswer || aConf == eSureAnswer) {
|
||||
mFeedChardet = false; // just in case
|
||||
nsAutoCString encoding;
|
||||
if (!EncodingUtils::FindEncodingForLabelNoReplacement(
|
||||
nsDependentCString(aCharset), encoding)) {
|
||||
const Encoding* encoding = Encoding::ForLabelNoReplacement(
|
||||
nsDependentCString(aCharset));
|
||||
if (!encoding) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoCString charset;
|
||||
encoding->Name(charset);
|
||||
if (HasDecoder()) {
|
||||
if (mCharset.Equals(encoding)) {
|
||||
if (mCharset.Equals(charset)) {
|
||||
NS_ASSERTION(mCharsetSource < kCharsetFromAutoDetection,
|
||||
"Why are we running chardet at all?");
|
||||
mCharsetSource = kCharsetFromAutoDetection;
|
||||
|
@ -269,7 +269,7 @@ nsHtml5StreamParser::Notify(const char* aCharset, nsDetectionConfident aConf)
|
|||
} else {
|
||||
// We've already committed to a decoder. Request a reload from the
|
||||
// docshell.
|
||||
mTreeBuilder->NeedsCharsetSwitchTo(encoding,
|
||||
mTreeBuilder->NeedsCharsetSwitchTo(charset,
|
||||
kCharsetFromAutoDetection,
|
||||
0);
|
||||
FlushTreeOpsAndDisarmTimer();
|
||||
|
@ -278,7 +278,7 @@ nsHtml5StreamParser::Notify(const char* aCharset, nsDetectionConfident aConf)
|
|||
} else {
|
||||
// Got a confident answer from the sniffing buffer. That code will
|
||||
// take care of setting up the decoder.
|
||||
mCharset.Assign(encoding);
|
||||
mCharset.Assign(charset);
|
||||
mCharsetSource = kCharsetFromAutoDetection;
|
||||
mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ nsHtml5StreamParser::SetupDecodingAndWriteSniffingBufferAndCurrentSegment(const
|
|||
{
|
||||
NS_ASSERTION(IsParserThread(), "Wrong thread!");
|
||||
nsresult rv = NS_OK;
|
||||
mUnicodeDecoder = EncodingUtils::DecoderForEncoding(mCharset);
|
||||
mUnicodeDecoder = Encoding::ForName(mCharset)->NewDecoderWithBOMRemoval();
|
||||
if (mSniffingBuffer) {
|
||||
uint32_t writeCount;
|
||||
rv = WriteStreamBytes(mSniffingBuffer.get(), mSniffingLength, &writeCount);
|
||||
|
@ -340,7 +340,7 @@ nsHtml5StreamParser::SetupDecodingFromBom(const char* aDecoderCharsetName)
|
|||
{
|
||||
NS_ASSERTION(IsParserThread(), "Wrong thread!");
|
||||
mCharset.Assign(aDecoderCharsetName);
|
||||
mUnicodeDecoder = EncodingUtils::DecoderForEncoding(mCharset);
|
||||
mUnicodeDecoder = Encoding::ForName(mCharset)->NewDecoderWithBOMRemoval();
|
||||
mCharsetSource = kCharsetFromByteOrderMark;
|
||||
mFeedChardet = false;
|
||||
mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource);
|
||||
|
@ -742,24 +742,26 @@ nsHtml5StreamParser::SniffStreamBytes(const uint8_t* aFromSegment,
|
|||
if (mMode == NORMAL || mMode == VIEW_SOURCE_HTML || mMode == LOAD_AS_DATA) {
|
||||
nsHtml5ByteReadable readable(aFromSegment, aFromSegment +
|
||||
countToSniffingLimit);
|
||||
nsAutoCString encoding;
|
||||
mMetaScanner->sniff(&readable, encoding);
|
||||
nsAutoCString charset;
|
||||
mMetaScanner->sniff(&readable, charset);
|
||||
// Due to the way nsHtml5Portability reports OOM, ask the tree buider
|
||||
nsresult rv;
|
||||
if (NS_FAILED((rv = mTreeBuilder->IsBroken()))) {
|
||||
MarkAsBroken(rv);
|
||||
return rv;
|
||||
}
|
||||
if (!encoding.IsEmpty()) {
|
||||
if (!charset.IsEmpty()) {
|
||||
const Encoding* encoding = Encoding::ForName(charset);
|
||||
// meta scan successful; honor overrides unless meta is XSS-dangerous
|
||||
if ((mCharsetSource == kCharsetFromParentForced ||
|
||||
mCharsetSource == kCharsetFromUserForced) &&
|
||||
EncodingUtils::IsAsciiCompatible(encoding)) {
|
||||
(encoding->IsAsciiCompatible() ||
|
||||
encoding == ISO_2022_JP_ENCODING)) {
|
||||
// Honor override
|
||||
return SetupDecodingAndWriteSniffingBufferAndCurrentSegment(
|
||||
aFromSegment, aCount, aWriteCount);
|
||||
}
|
||||
mCharset.Assign(encoding);
|
||||
mCharset.Assign(charset);
|
||||
mCharsetSource = kCharsetFromMetaPrescan;
|
||||
mFeedChardet = false;
|
||||
mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource);
|
||||
|
@ -780,24 +782,26 @@ nsHtml5StreamParser::SniffStreamBytes(const uint8_t* aFromSegment,
|
|||
// not the last buffer
|
||||
if (mMode == NORMAL || mMode == VIEW_SOURCE_HTML || mMode == LOAD_AS_DATA) {
|
||||
nsHtml5ByteReadable readable(aFromSegment, aFromSegment + aCount);
|
||||
nsAutoCString encoding;
|
||||
mMetaScanner->sniff(&readable, encoding);
|
||||
nsAutoCString charset;
|
||||
mMetaScanner->sniff(&readable, charset);
|
||||
// Due to the way nsHtml5Portability reports OOM, ask the tree buider
|
||||
nsresult rv;
|
||||
if (NS_FAILED((rv = mTreeBuilder->IsBroken()))) {
|
||||
MarkAsBroken(rv);
|
||||
return rv;
|
||||
}
|
||||
if (!encoding.IsEmpty()) {
|
||||
if (!charset.IsEmpty()) {
|
||||
const Encoding* encoding = Encoding::ForName(charset);
|
||||
// meta scan successful; honor overrides unless meta is XSS-dangerous
|
||||
if ((mCharsetSource == kCharsetFromParentForced ||
|
||||
mCharsetSource == kCharsetFromUserForced) &&
|
||||
EncodingUtils::IsAsciiCompatible(encoding)) {
|
||||
(encoding->IsAsciiCompatible() ||
|
||||
encoding == ISO_2022_JP_ENCODING)) {
|
||||
// Honor override
|
||||
return SetupDecodingAndWriteSniffingBufferAndCurrentSegment(aFromSegment,
|
||||
aCount, aWriteCount);
|
||||
}
|
||||
mCharset.Assign(encoding);
|
||||
mCharset.Assign(charset);
|
||||
mCharsetSource = kCharsetFromMetaPrescan;
|
||||
mFeedChardet = false;
|
||||
mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource);
|
||||
|
@ -1003,7 +1007,7 @@ nsHtml5StreamParser::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
|||
mFeedChardet = false;
|
||||
|
||||
// Instantiate the converter here to avoid BOM sniffing.
|
||||
mUnicodeDecoder = EncodingUtils::DecoderForEncoding(mCharset);
|
||||
mUnicodeDecoder = Encoding::ForName(mCharset)->NewDecoderWithBOMRemoval();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1230,8 +1234,8 @@ nsHtml5StreamParser::CopySegmentsToParser(nsIInputStream *aInStream,
|
|||
bool
|
||||
nsHtml5StreamParser::PreferredForInternalEncodingDecl(nsACString& aEncoding)
|
||||
{
|
||||
nsAutoCString newEncoding;
|
||||
if (!EncodingUtils::FindEncodingForLabel(aEncoding, newEncoding)) {
|
||||
const Encoding* newEncoding = Encoding::ForLabel(aEncoding);
|
||||
if (!newEncoding) {
|
||||
// the encoding name is bogus
|
||||
mTreeBuilder->MaybeComplainAboutCharset("EncMetaUnsupported",
|
||||
true,
|
||||
|
@ -1239,23 +1243,23 @@ nsHtml5StreamParser::PreferredForInternalEncodingDecl(nsACString& aEncoding)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (newEncoding.EqualsLiteral("UTF-16BE") ||
|
||||
newEncoding.EqualsLiteral("UTF-16LE")) {
|
||||
if (newEncoding == UTF_16BE_ENCODING ||
|
||||
newEncoding == UTF_16LE_ENCODING) {
|
||||
mTreeBuilder->MaybeComplainAboutCharset("EncMetaUtf16",
|
||||
true,
|
||||
mTokenizer->getLineNumber());
|
||||
newEncoding.AssignLiteral("UTF-8");
|
||||
newEncoding = UTF_8_ENCODING;
|
||||
}
|
||||
|
||||
if (newEncoding.EqualsLiteral("x-user-defined")) {
|
||||
if (newEncoding == X_USER_DEFINED_ENCODING) {
|
||||
// WebKit/Blink hack for Indian and Armenian legacy sites
|
||||
mTreeBuilder->MaybeComplainAboutCharset("EncMetaUserDefined",
|
||||
true,
|
||||
mTokenizer->getLineNumber());
|
||||
newEncoding.AssignLiteral("windows-1252");
|
||||
newEncoding = WINDOWS_1252_ENCODING;
|
||||
}
|
||||
|
||||
if (newEncoding.Equals(mCharset)) {
|
||||
if (newEncoding == Encoding::ForName(mCharset)) {
|
||||
if (mCharsetSource < kCharsetFromMetaPrescan) {
|
||||
if (mInitialEncodingWasFromParentFrame) {
|
||||
mTreeBuilder->MaybeComplainAboutCharset("EncLateMetaFrame",
|
||||
|
@ -1272,7 +1276,7 @@ nsHtml5StreamParser::PreferredForInternalEncodingDecl(nsACString& aEncoding)
|
|||
return false;
|
||||
}
|
||||
|
||||
aEncoding.Assign(newEncoding);
|
||||
newEncoding->Name(aEncoding);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,16 +34,14 @@
|
|||
#include "mozilla/CondVar.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "nsCharsetSource.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIHTMLContentSink.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/ScriptLoader.h"
|
||||
#include "mozilla/BinarySearch.h"
|
||||
#include "mozilla/dom/ScriptLoader.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
#define NS_PARSER_FLAG_OBSERVERS_ENABLED 0x00000004
|
||||
#define NS_PARSER_FLAG_PENDING_CONTINUE_EVENT 0x00000008
|
||||
|
@ -1334,23 +1332,27 @@ ParserWriteFunc(nsIInputStream* in,
|
|||
pws->mNeedCharsetCheck = false;
|
||||
int32_t source;
|
||||
nsAutoCString preferred;
|
||||
nsAutoCString maybePrefer;
|
||||
pws->mParser->GetDocumentCharset(preferred, source);
|
||||
|
||||
// This code was bogus when I found it. It expects the BOM or the XML
|
||||
// declaration to be entirely in the first network buffer. -- hsivonen
|
||||
if (nsContentUtils::CheckForBOM(buf, count, maybePrefer)) {
|
||||
const Encoding* encoding;
|
||||
size_t bomLength;
|
||||
Tie(encoding, bomLength) = Encoding::ForBOM(MakeSpan(buf, count));
|
||||
Unused << bomLength;
|
||||
if (encoding) {
|
||||
// The decoder will swallow the BOM. The UTF-16 will re-sniff for
|
||||
// endianness. The value of preferred is now "UTF-8", "UTF-16LE"
|
||||
// or "UTF-16BE".
|
||||
preferred.Assign(maybePrefer);
|
||||
encoding->Name(preferred);
|
||||
source = kCharsetFromByteOrderMark;
|
||||
} else if (source < kCharsetFromChannel) {
|
||||
nsAutoCString declCharset;
|
||||
|
||||
if (ExtractCharsetFromXmlDeclaration(buf, count, declCharset)) {
|
||||
if (EncodingUtils::FindEncodingForLabel(declCharset, maybePrefer)) {
|
||||
preferred.Assign(maybePrefer);
|
||||
encoding = Encoding::ForLabel(declCharset);
|
||||
if (encoding) {
|
||||
encoding->Name(preferred);
|
||||
source = kCharsetFromMetaTag;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
|
||||
//#define __INCREMENTAL 1
|
||||
|
||||
#include "nsScanner.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
|
||||
#include "nsScanner.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
@ -19,10 +20,6 @@
|
|||
#include "nsParser.h"
|
||||
#include "nsCharsetSource.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
nsReadEndCondition::nsReadEndCondition(const char16_t* aTerminateChars) :
|
||||
mChars(aTerminateChars), mFilter(char16_t(~0)) // All bits set
|
||||
{
|
||||
|
@ -106,15 +103,16 @@ nsresult nsScanner::SetDocumentCharset(const nsACString& aCharset , int32_t aSou
|
|||
|
||||
mCharsetSource = aSource;
|
||||
|
||||
nsCString charsetName;
|
||||
const Encoding* encoding;
|
||||
if (aCharset.EqualsLiteral("replacement")) {
|
||||
charsetName.Assign(aCharset);
|
||||
encoding = REPLACEMENT_ENCODING;
|
||||
} else {
|
||||
mozilla::DebugOnly<bool> valid =
|
||||
EncodingUtils::FindEncodingForLabel(aCharset, charsetName);
|
||||
MOZ_ASSERT(valid, "Should never call with a bogus aCharset.");
|
||||
encoding = Encoding::ForLabel(aCharset);
|
||||
MOZ_ASSERT(encoding, "Should never call with a bogus aCharset.");
|
||||
}
|
||||
|
||||
nsCString charsetName;
|
||||
encoding->Name(charsetName);
|
||||
if (!mCharset.IsEmpty() && charsetName.Equals(mCharset)) {
|
||||
return NS_OK; // no difference, don't change it
|
||||
}
|
||||
|
@ -123,7 +121,7 @@ nsresult nsScanner::SetDocumentCharset(const nsACString& aCharset , int32_t aSou
|
|||
|
||||
mCharset.Assign(charsetName);
|
||||
|
||||
mUnicodeDecoder = EncodingUtils::DecoderForEncoding(mCharset);
|
||||
mUnicodeDecoder = encoding->NewDecoderWithBOMRemoval();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsSAXXMLReader.h"
|
||||
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -14,12 +17,9 @@
|
|||
#include "nsIScriptError.h"
|
||||
#include "nsSAXAttributes.h"
|
||||
#include "nsSAXLocator.h"
|
||||
#include "nsSAXXMLReader.h"
|
||||
#include "nsCharsetSource.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
using mozilla::Encoding;
|
||||
|
||||
#define XMLNS_URI "http://www.w3.org/2000/xmlns/"
|
||||
|
||||
|
@ -653,11 +653,11 @@ nsSAXXMLReader::TryChannelCharset(nsIChannel *aChannel,
|
|||
nsAutoCString charsetVal;
|
||||
nsresult rv = aChannel->GetContentCharset(charsetVal);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoCString preferred;
|
||||
if (!EncodingUtils::FindEncodingForLabel(charsetVal, preferred))
|
||||
const Encoding* preferred = Encoding::ForLabel(charsetVal);
|
||||
if (!preferred)
|
||||
return false;
|
||||
|
||||
aCharset = preferred;
|
||||
preferred->Name(aCharset);
|
||||
aCharsetSource = kCharsetFromChannel;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1161,4 +1161,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
|
|||
|
||||
static const int32_t kUnknownId = -1;
|
||||
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1506180969403000);
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1506266483788000);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -189,7 +189,7 @@ add_test(function test_get_utf8() {
|
|||
|
||||
let converter = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
converter.init(res.bodyOutputStream, "UTF-8", 0, 0x0000);
|
||||
converter.init(res.bodyOutputStream, "UTF-8");
|
||||
converter.writeString(response);
|
||||
converter.close();
|
||||
}});
|
||||
|
@ -270,7 +270,7 @@ add_test(function test_charsets() {
|
|||
|
||||
let converter = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
converter.init(res.bodyOutputStream, "us-ascii", 0, 0x0000);
|
||||
converter.init(res.bodyOutputStream, "us-ascii");
|
||||
converter.writeString(response);
|
||||
converter.close();
|
||||
}});
|
||||
|
|
|
@ -86,7 +86,7 @@ add_test(function test_load_logging() {
|
|||
fos.init(file, flags, FileUtils.PERMS_FILE, fos.DEFER_OPEN);
|
||||
let stream = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
stream.init(fos, "UTF-8", 4096, 0x0000);
|
||||
stream.init(fos, "UTF-8");
|
||||
stream.writeString("invalid json!");
|
||||
stream.close();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ var Logger = {
|
|||
this._foStream.init(this._file, fileflags, 0o666, 0);
|
||||
this._converter = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
this._converter.init(this._foStream, "UTF-8", 0, 0);
|
||||
this._converter.init(this._foStream, "UTF-8");
|
||||
},
|
||||
|
||||
write(data) {
|
||||
|
|
|
@ -549,7 +549,7 @@ impl Stylist {
|
|||
if *local_name == local_name!("style") {
|
||||
self.style_attribute_dependency
|
||||
} else {
|
||||
self.attribute_dependencies.might_contain(local_name)
|
||||
self.attribute_dependencies.might_contain_hash(local_name.get_hash())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ impl Stylist {
|
|||
/// of our rule maps.
|
||||
#[inline]
|
||||
pub fn may_have_rules_for_id(&self, id: &Atom) -> bool {
|
||||
self.mapped_ids.might_contain(id)
|
||||
self.mapped_ids.might_contain_hash(id.get_hash())
|
||||
}
|
||||
|
||||
/// Return whether the device is dirty, that is, whether the screen size or
|
||||
|
@ -1304,16 +1304,11 @@ impl<'a> SelectorVisitor for AttributeAndStateDependencyVisitor<'a> {
|
|||
fn visit_attribute_selector(&mut self, _ns: &NamespaceConstraint<&Namespace>,
|
||||
name: &LocalName, lower_name: &LocalName)
|
||||
-> bool {
|
||||
#[cfg(feature = "servo")]
|
||||
let style_lower_name = local_name!("style");
|
||||
#[cfg(feature = "gecko")]
|
||||
let style_lower_name = atom!("style");
|
||||
|
||||
if *lower_name == style_lower_name {
|
||||
if *lower_name == local_name!("style") {
|
||||
*self.style_attribute_dependency = true;
|
||||
} else {
|
||||
self.attribute_dependencies.insert(&name);
|
||||
self.attribute_dependencies.insert(&lower_name);
|
||||
self.attribute_dependencies.insert_hash(name.get_hash());
|
||||
self.attribute_dependencies.insert_hash(lower_name.get_hash());
|
||||
}
|
||||
true
|
||||
}
|
||||
|
@ -1337,7 +1332,7 @@ impl<'a> SelectorVisitor for MappedIdVisitor<'a> {
|
|||
/// We just want to insert all the ids we find into mapped_ids.
|
||||
fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool {
|
||||
if let Component::ID(ref id) = *s {
|
||||
self.mapped_ids.insert(id);
|
||||
self.mapped_ids.insert_hash(id.get_hash());
|
||||
}
|
||||
true
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ MozillaFileLogger.prototype = {
|
|||
|
||||
this._converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
|
||||
createInstance(Components.interfaces.nsIConverterOutputStream);
|
||||
this._converter.init(this._foStream, "UTF-8", 0, 0);
|
||||
this._converter.init(this._foStream, "UTF-8");
|
||||
},
|
||||
|
||||
getLogCallback() {
|
||||
|
|
|
@ -2,11 +2,3 @@
|
|||
type: testharness
|
||||
[Equivalent property indexed and sequenced keyframes: same offset applied to all keyframes]
|
||||
expected: FAIL
|
||||
|
||||
[Custom iterator with value list in keyframe should give bizarre string representation of list.]
|
||||
expected:
|
||||
if not debug and stylo and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and stylo and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and stylo and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and stylo and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
[setTarget.html]
|
||||
type: testharness
|
||||
[Test paced spacing mode after setting a new target]
|
||||
expected:
|
||||
if not debug and stylo and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and stylo and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and stylo and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and stylo and not e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
* Native implementation of some OS.File operations.
|
||||
*/
|
||||
|
||||
#include "NativeOSFileInternals.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -15,13 +17,11 @@
|
|||
#include "nsProxyRelease.h"
|
||||
|
||||
#include "nsINativeOSFileInternals.h"
|
||||
#include "NativeOSFileInternals.h"
|
||||
#include "mozilla/dom/NativeOSFileInternalsBinding.h"
|
||||
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsIEventTarget.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/HoldDropJSObjects.h"
|
||||
|
@ -791,12 +791,12 @@ protected:
|
|||
// Obtain the decoder. We do this before reading to avoid doing
|
||||
// any unnecessary I/O in case the name of the encoding is incorrect.
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
nsAutoCString encodingName;
|
||||
if (!dom::EncodingUtils::FindEncodingForLabel(mEncoding, encodingName)) {
|
||||
const Encoding* encoding = Encoding::ForLabel(mEncoding);
|
||||
if (!encoding) {
|
||||
Fail(NS_LITERAL_CSTRING("Decode"), mResult.forget(), OS_ERROR_INVAL);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mDecoder = dom::EncodingUtils::DecoderForEncoding(encodingName);
|
||||
mDecoder = encoding->NewDecoderWithBOMRemoval();
|
||||
if (!mDecoder) {
|
||||
Fail(NS_LITERAL_CSTRING("DecoderForEncoding"), mResult.forget(), OS_ERROR_INVAL);
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -1015,7 +1015,7 @@ BookmarkExporter.prototype = {
|
|||
// Write bookmarks in UTF-8.
|
||||
this._converterOut = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
this._converterOut.init(bufferedOut, "utf-8", 0, 0);
|
||||
this._converterOut.init(bufferedOut, "utf-8");
|
||||
try {
|
||||
this._writeHeader();
|
||||
await this._writeContainer(this._root);
|
||||
|
|
|
@ -447,7 +447,7 @@ var gViewSourceUtils = {
|
|||
foStream.init(this.file, 0x02 | 0x08 | 0x20, -1, 0); // write | create | truncate
|
||||
var coStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIConverterOutputStream);
|
||||
coStream.init(foStream, this.data.doc.characterSet, 0, null);
|
||||
coStream.init(foStream, this.data.doc.characterSet);
|
||||
|
||||
// write the source to the file
|
||||
coStream.writeString(webNavigation.document.body.textContent);
|
||||
|
|
|
@ -106,7 +106,7 @@ function writeFile(dirName, fileName, data) {
|
|||
fs.init(path, -1, -1, 0);
|
||||
var os = Cc["@mozilla.org/intl/converter-output-stream;1"].
|
||||
createInstance(Ci.nsIConverterOutputStream);
|
||||
os.init(fs, "UTF-8", 0, 0x0000);
|
||||
os.init(fs, "UTF-8");
|
||||
os.writeString(data);
|
||||
os.close();
|
||||
fs.close();
|
||||
|
|
|
@ -105,7 +105,7 @@ function writeDataToFile(file, data) {
|
|||
fstream.init(file, -1, -1, 0);
|
||||
var os = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
os.init(fstream, "UTF-8", 0, 0x0000);
|
||||
os.init(fstream, "UTF-8");
|
||||
os.writeString(data);
|
||||
os.close();
|
||||
fstream.close();
|
||||
|
|
|
@ -793,9 +793,7 @@ StorageStreamAppender.prototype = {
|
|||
this._converterStream = Cc["@mozilla.org/intl/converter-output-stream;1"]
|
||||
.createInstance(Ci.nsIConverterOutputStream);
|
||||
}
|
||||
this._converterStream.init(
|
||||
this._outputStream, "UTF-8", STREAM_SEGMENT_SIZE,
|
||||
Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
|
||||
this._converterStream.init(this._outputStream, "UTF-8");
|
||||
}
|
||||
return this._converterStream;
|
||||
},
|
||||
|
|
|
@ -250,7 +250,7 @@ function writeStringToFile(file, string) {
|
|||
stream.init(file, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
|
||||
FileUtils.MODE_TRUNCATE, FileUtils.PERMS_FILE,
|
||||
0);
|
||||
converter.init(stream, "UTF-8", 0, 0x0000);
|
||||
converter.init(stream, "UTF-8");
|
||||
converter.writeString(string);
|
||||
} finally {
|
||||
converter.close();
|
||||
|
|
|
@ -551,7 +551,7 @@ function writeStringToFile(file, string) {
|
|||
stream.init(file, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
|
||||
FileUtils.MODE_TRUNCATE, FileUtils.PERMS_FILE,
|
||||
0);
|
||||
converter.init(stream, "UTF-8", 0, 0x0000);
|
||||
converter.init(stream, "UTF-8");
|
||||
converter.writeString(string);
|
||||
} finally {
|
||||
converter.close();
|
||||
|
|
|
@ -1289,7 +1289,7 @@ function saveJSON(aData, aFile) {
|
|||
let stream = FileUtils.openSafeFileOutputStream(aFile);
|
||||
let converter = AM_Cc["@mozilla.org/intl/converter-output-stream;1"].
|
||||
createInstance(AM_Ci.nsIConverterOutputStream);
|
||||
converter.init(stream, "UTF-8", 0, 0x0000);
|
||||
converter.init(stream, "UTF-8");
|
||||
// XXX pretty print the JSON while debugging
|
||||
converter.writeString(JSON.stringify(aData, null, 2));
|
||||
converter.flush();
|
||||
|
|
|
@ -134,7 +134,7 @@ async function run_test_1() {
|
|||
stream.init(jsonfile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
|
||||
FileUtils.MODE_TRUNCATE, FileUtils.PERMS_FILE,
|
||||
0);
|
||||
converter.init(stream, "UTF-8", 0, 0x0000);
|
||||
converter.init(stream, "UTF-8");
|
||||
converter.writeString(JSON.stringify(addonObj));
|
||||
converter.close();
|
||||
stream.close();
|
||||
|
@ -275,7 +275,7 @@ async function run_test_2() {
|
|||
stream.init(jsonfile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
|
||||
FileUtils.MODE_TRUNCATE, FileUtils.PERMS_FILE,
|
||||
0);
|
||||
converter.init(stream, "UTF-8", 0, 0x0000);
|
||||
converter.init(stream, "UTF-8");
|
||||
converter.writeString(JSON.stringify(addonObj));
|
||||
converter.close();
|
||||
stream.close();
|
||||
|
|
|
@ -25,20 +25,6 @@ interface nsIConverterOutputStream : nsIUnicharOutputStream
|
|||
* @param aCharset
|
||||
* The character set to use for encoding the characters. A null
|
||||
* charset will be interpreted as UTF-8.
|
||||
* @param aBufferSize
|
||||
* How many bytes to buffer. A value of 0 means that no bytes will be
|
||||
* buffered. Implementations not supporting buffering may ignore
|
||||
* this parameter.
|
||||
* @param aReplacementCharacter
|
||||
* The replacement character to use when an unsupported character is found.
|
||||
* The character must be encodable in the selected character
|
||||
* encoding; otherwise, attempts to write an unsupported character
|
||||
* will throw NS_ERROR_LOSS_OF_SIGNIFICANT_DATA.
|
||||
*
|
||||
* A value of 0x0000 will cause an exception to be thrown upon
|
||||
* attempts to write unsupported characters.
|
||||
*/
|
||||
void init(in nsIOutputStream aOutStream, in string aCharset,
|
||||
in unsigned long aBufferSize,
|
||||
in char16_t aReplacementCharacter);
|
||||
void init(in nsIOutputStream aOutStream, in string aCharset);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче