mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 6db369a15ea7 (bug 599320) for frequent failures in bug599320-1.html
This commit is contained in:
parent
bc5d39a9c1
commit
a93125dee2
@ -313,7 +313,11 @@ nsHTMLDocument::CreateShell(nsPresContext* aContext,
|
||||
aInstancePtrResult);
|
||||
}
|
||||
|
||||
void
|
||||
// The following Try*Charset will return false only if the charset source
|
||||
// should be considered (ie. aCharsetSource < thisCharsetSource) but we failed
|
||||
// to get the charset from this source.
|
||||
|
||||
bool
|
||||
nsHTMLDocument::TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
int32_t& aCharsetSource, nsACString& aCharset)
|
||||
{
|
||||
@ -327,17 +331,17 @@ nsHTMLDocument::TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
aMarkupDV->SetHintCharacterSetSource((int32_t)(kCharsetUninitialized));
|
||||
|
||||
if(requestCharsetSource <= aCharsetSource)
|
||||
return;
|
||||
return true;
|
||||
|
||||
if(NS_SUCCEEDED(rv) && IsAsciiCompatible(requestCharset)) {
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
aCharsetSource = requestCharsetSource;
|
||||
aCharset = requestCharset;
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -357,8 +361,6 @@ nsHTMLDocument::TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
rv = aMarkupDV->GetForceCharacterSet(forceCharsetFromDocShell);
|
||||
}
|
||||
|
||||
// Not making the IsAsciiCompatible() check here to allow the user to
|
||||
// force UTF-16 from the menu.
|
||||
if(NS_SUCCEEDED(rv) && !forceCharsetFromDocShell.IsEmpty()) {
|
||||
aCharset = forceCharsetFromDocShell;
|
||||
//TODO: we should define appropriate constant for force charset
|
||||
@ -390,12 +392,7 @@ nsHTMLDocument::TryCacheCharset(nsICachingChannel* aCachingChannel,
|
||||
|
||||
nsCString cachedCharset;
|
||||
rv = aCachingChannel->GetCacheTokenCachedCharset(cachedCharset);
|
||||
// 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 (NS_SUCCEEDED(rv) &&
|
||||
!cachedCharset.IsEmpty() &&
|
||||
IsAsciiCompatible(cachedCharset))
|
||||
if (NS_SUCCEEDED(rv) && !cachedCharset.IsEmpty())
|
||||
{
|
||||
aCharset = cachedCharset;
|
||||
aCharsetSource = kCharsetFromCache;
|
||||
@ -420,87 +417,69 @@ CheckSameOrigin(nsINode* aNode1, nsINode* aNode2)
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLDocument::IsAsciiCompatible(const nsACString& aPreferredName)
|
||||
{
|
||||
return !(aPreferredName.LowerCaseEqualsLiteral("utf-16") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-16be") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-16le") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("utf-7") ||
|
||||
aPreferredName.LowerCaseEqualsLiteral("x-imap4-modified-utf7"));
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLDocument::TryParentCharset(nsIDocShell* aDocShell,
|
||||
nsIDocument* aParentDocument,
|
||||
int32_t& aCharsetSource,
|
||||
nsACString& aCharset)
|
||||
{
|
||||
if (!aDocShell) {
|
||||
return;
|
||||
}
|
||||
int32_t source;
|
||||
nsCOMPtr<nsIAtom> csAtom;
|
||||
int32_t parentSource;
|
||||
nsAutoCString parentCharset;
|
||||
aDocShell->GetParentCharset(getter_AddRefs(csAtom));
|
||||
if (!csAtom) {
|
||||
return;
|
||||
}
|
||||
aDocShell->GetParentCharsetSource(&parentSource);
|
||||
csAtom->ToUTF8String(parentCharset);
|
||||
if (kCharsetFromParentForced <= parentSource) {
|
||||
source = kCharsetFromParentForced;
|
||||
} else if (kCharsetFromHintPrevDoc == parentSource) {
|
||||
// Make sure that's OK
|
||||
if (!aParentDocument ||
|
||||
!CheckSameOrigin(this, aParentDocument) ||
|
||||
!IsAsciiCompatible(parentCharset)) {
|
||||
return;
|
||||
if (aDocShell) {
|
||||
int32_t source;
|
||||
nsCOMPtr<nsIAtom> csAtom;
|
||||
int32_t parentSource;
|
||||
aDocShell->GetParentCharsetSource(&parentSource);
|
||||
if (kCharsetFromParentForced <= parentSource)
|
||||
source = kCharsetFromParentForced;
|
||||
else if (kCharsetFromHintPrevDoc == parentSource) {
|
||||
// Make sure that's OK
|
||||
if (!aParentDocument || !CheckSameOrigin(this, aParentDocument)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if parent is posted doc, set this prevent autodections
|
||||
// I'm not sure this makes much sense... but whatever.
|
||||
source = kCharsetFromHintPrevDoc;
|
||||
}
|
||||
else if (kCharsetFromCache <= parentSource) {
|
||||
// Make sure that's OK
|
||||
if (!aParentDocument || !CheckSameOrigin(this, aParentDocument)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if parent is posted doc, set this prevent autodetections
|
||||
// I'm not sure this makes much sense... but whatever.
|
||||
source = kCharsetFromHintPrevDoc;
|
||||
} else if (kCharsetFromCache <= parentSource) {
|
||||
// Make sure that's OK
|
||||
if (!aParentDocument ||
|
||||
!CheckSameOrigin(this, aParentDocument) ||
|
||||
!IsAsciiCompatible(parentCharset)) {
|
||||
return;
|
||||
source = kCharsetFromParentFrame;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
source = kCharsetFromParentFrame;
|
||||
} else {
|
||||
return;
|
||||
if (source < aCharsetSource)
|
||||
return true;
|
||||
|
||||
aDocShell->GetParentCharset(getter_AddRefs(csAtom));
|
||||
if (csAtom) {
|
||||
csAtom->ToUTF8String(aCharset);
|
||||
aCharsetSource = source;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (source < aCharsetSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
aCharset.Assign(parentCharset);
|
||||
aCharsetSource = source;
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
nsHTMLDocument::UseWeakDocTypeDefault(int32_t& aCharsetSource,
|
||||
nsACString& aCharset)
|
||||
{
|
||||
if (kCharsetFromWeakDocTypeDefault <= aCharsetSource)
|
||||
return;
|
||||
return true;
|
||||
// fallback value in case docshell return error
|
||||
aCharset.AssignLiteral("ISO-8859-1");
|
||||
|
||||
const nsAdoptingCString& defCharset =
|
||||
Preferences::GetLocalizedCString("intl.charset.default");
|
||||
|
||||
// Don't let the user break things by setting intl.charset.default to
|
||||
// not a rough ASCII superset
|
||||
if (!defCharset.IsEmpty() && IsAsciiCompatible(defCharset)) {
|
||||
if (!defCharset.IsEmpty()) {
|
||||
aCharset = defCharset;
|
||||
} else {
|
||||
aCharset.AssignLiteral("ISO-8859-1");
|
||||
aCharsetSource = kCharsetFromWeakDocTypeDefault;
|
||||
}
|
||||
aCharsetSource = kCharsetFromWeakDocTypeDefault;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -515,8 +494,6 @@ nsHTMLDocument::TryDefaultCharset( nsIMarkupDocumentViewer* aMarkupDV,
|
||||
if (aMarkupDV) {
|
||||
nsresult rv =
|
||||
aMarkupDV->GetDefaultCharacterSet(defaultCharsetFromDocShell);
|
||||
// Not making the IsAsciiCompatible() check here to allow the user to
|
||||
// force UTF-16 from the menu.
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
aCharset = defaultCharsetFromDocShell;
|
||||
|
||||
|
@ -218,9 +218,7 @@ protected:
|
||||
|
||||
static uint32_t gWyciwygSessionCnt;
|
||||
|
||||
static bool IsAsciiCompatible(const nsACString& aPreferredName);
|
||||
|
||||
static void TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
static bool TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
int32_t& aCharsetSource,
|
||||
nsACString& aCharset);
|
||||
static bool TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
@ -231,10 +229,10 @@ protected:
|
||||
int32_t& aCharsetSource,
|
||||
nsACString& aCharset);
|
||||
// aParentDocument could be null.
|
||||
void TryParentCharset(nsIDocShell* aDocShell,
|
||||
bool TryParentCharset(nsIDocShell* aDocShell,
|
||||
nsIDocument* aParentDocument,
|
||||
int32_t& charsetSource, nsACString& aCharset);
|
||||
static void UseWeakDocTypeDefault(int32_t& aCharsetSource,
|
||||
static bool UseWeakDocTypeDefault(int32_t& aCharsetSource,
|
||||
nsACString& aCharset);
|
||||
static bool TryDefaultCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
int32_t& aCharsetSource,
|
||||
|
@ -56,7 +56,10 @@ nsHtml5MetaScanner::tryCharset(nsString* charset)
|
||||
preferred.LowerCaseEqualsLiteral("utf-16be") ||
|
||||
preferred.LowerCaseEqualsLiteral("utf-16le") ||
|
||||
preferred.LowerCaseEqualsLiteral("utf-7") ||
|
||||
preferred.LowerCaseEqualsLiteral("x-imap4-modified-utf7")) {
|
||||
preferred.LowerCaseEqualsLiteral("jis_x0212-1990") ||
|
||||
preferred.LowerCaseEqualsLiteral("x-jis0208") ||
|
||||
preferred.LowerCaseEqualsLiteral("x-imap4-modified-utf7") ||
|
||||
preferred.LowerCaseEqualsLiteral("x-user-defined")) {
|
||||
return false;
|
||||
}
|
||||
res = convManager->GetUnicodeDecoderRaw(preferred.get(), getter_AddRefs(mUnicodeDecoder));
|
||||
|
@ -1213,7 +1213,10 @@ nsHtml5StreamParser::PreferredForInternalEncodingDecl(nsACString& aEncoding)
|
||||
preferred.LowerCaseEqualsLiteral("utf-16be") ||
|
||||
preferred.LowerCaseEqualsLiteral("utf-16le") ||
|
||||
preferred.LowerCaseEqualsLiteral("utf-7") ||
|
||||
preferred.LowerCaseEqualsLiteral("x-imap4-modified-utf7")) {
|
||||
preferred.LowerCaseEqualsLiteral("jis_x0212-1990") ||
|
||||
preferred.LowerCaseEqualsLiteral("x-jis0208") ||
|
||||
preferred.LowerCaseEqualsLiteral("x-imap4-modified-utf7") ||
|
||||
preferred.LowerCaseEqualsLiteral("x-user-defined")) {
|
||||
// Not a rough ASCII superset
|
||||
mTreeBuilder->MaybeComplainAboutCharset("EncMetaNonRoughSuperset",
|
||||
true,
|
||||
|
@ -1,17 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta content="width=device-width, initial-scale=1" name="viewport">
|
||||
<title>UTF-16 doc</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>UTF-16 doc</h1>
|
||||
|
||||
<p>Euro sign: €</p>
|
||||
<p>iframe:</p>
|
||||
<iframe src=frame599320-1-ref.html width=300 height=400></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Binary file not shown.
@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta content="width=device-width, initial-scale=1" name="viewport">
|
||||
<title>Non-UTF-16 doc</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Non-UTF-16 doc</h1>
|
||||
|
||||
<p>Euro sign: €</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,6 @@
|
||||
== bug582788-1.html bug582788-1-ref.html
|
||||
== bug582940-1.html bug582940-1-ref.html
|
||||
== bug592656-1.html bug592656-1-ref.html
|
||||
== bug599320-1.html bug599320-1-ref.html
|
||||
== bug608373-1.html bug608373-1-ref.html
|
||||
fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccelerated&&!azureSkia) == view-source:bug482921-1.html bug482921-1-ref.html # bug 703201
|
||||
== view-source:bug482921-2.xhtml bug482921-2-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user