mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 927262, don't cache the encoder in case of unsual content type, r=hsivonen
This commit is contained in:
parent
51bcfeb92d
commit
6b19963a8c
@ -3119,6 +3119,7 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
|
||||
|
||||
nsAutoString contentType;
|
||||
doc->GetContentType(contentType);
|
||||
bool tryToCacheEncoder = !aIncludeSelf;
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> docEncoder = doc->GetCachedEncoder();
|
||||
if (!docEncoder) {
|
||||
@ -3133,6 +3134,9 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
|
||||
// again as XML
|
||||
contentType.AssignLiteral("application/xml");
|
||||
docEncoder = do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "application/xml");
|
||||
// Don't try to cache the encoder since it would point to a different
|
||||
// contentType once it has been reinitialized.
|
||||
tryToCacheEncoder = false;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE_VOID(docEncoder);
|
||||
@ -3163,7 +3167,7 @@ Element::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
|
||||
}
|
||||
rv = docEncoder->EncodeToString(aMarkup);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
if (!aIncludeSelf) {
|
||||
if (tryToCacheEncoder) {
|
||||
doc->SetCachedEncoder(docEncoder.forget());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user