mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 801402 - Use FindEncodingForLabel from XSLT. r=sicking
This commit is contained in:
parent
d5f7afda05
commit
b7bc4daca4
@ -5,7 +5,6 @@
|
||||
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsCharsetAlias.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -39,10 +38,12 @@
|
||||
#include "nsIURL.h"
|
||||
#include "nsCrossSiteListenerProxy.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||
|
||||
@ -258,7 +259,7 @@ txStylesheetSink::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
|
||||
nsAutoCString charsetVal;
|
||||
nsAutoCString charset;
|
||||
if (NS_SUCCEEDED(channel->GetContentCharset(charsetVal))) {
|
||||
if (NS_SUCCEEDED(nsCharsetAlias::GetPreferred(charsetVal, charset))) {
|
||||
if (EncodingUtils::FindEncodingForLabel(charsetVal, charset)) {
|
||||
charsetSource = kCharsetFromChannel;
|
||||
}
|
||||
}
|
||||
|
@ -12,12 +12,12 @@
|
||||
#include "nsIDocumentTransformer.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsCharsetSource.h"
|
||||
#include "nsCharsetAlias.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "txURIUtils.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -149,11 +149,10 @@ txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument)
|
||||
|
||||
// Set the charset
|
||||
if (!mOutputFormat.mEncoding.IsEmpty()) {
|
||||
NS_LossyConvertUTF16toASCII charset(mOutputFormat.mEncoding);
|
||||
nsAutoCString canonicalCharset;
|
||||
|
||||
if (NS_SUCCEEDED(nsCharsetAlias::GetPreferred(charset,
|
||||
canonicalCharset))) {
|
||||
if (EncodingUtils::FindEncodingForLabel(mOutputFormat.mEncoding,
|
||||
canonicalCharset)) {
|
||||
mDocument->SetDocumentCharacterSetSource(kCharsetFromOtherComponent);
|
||||
mDocument->SetDocumentCharacterSet(canonicalCharset);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "nsIDocumentTransformer.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsCharsetAlias.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "txXMLUtils.h"
|
||||
#include "nsContentSink.h"
|
||||
@ -826,9 +826,9 @@ txMozillaXMLOutput::createResultDocument(const nsSubstring& aName, int32_t aNsID
|
||||
|
||||
// Set the charset
|
||||
if (!mOutputFormat.mEncoding.IsEmpty()) {
|
||||
NS_LossyConvertUTF16toASCII charset(mOutputFormat.mEncoding);
|
||||
nsAutoCString canonicalCharset;
|
||||
if (NS_SUCCEEDED(nsCharsetAlias::GetPreferred(charset, canonicalCharset))) {
|
||||
if (EncodingUtils::FindEncodingForLabel(mOutputFormat.mEncoding,
|
||||
canonicalCharset)) {
|
||||
mDocument->SetDocumentCharacterSetSource(kCharsetFromOtherComponent);
|
||||
mDocument->SetDocumentCharacterSet(canonicalCharset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user