Fixing regression bug 244178. Don't advertise the charset of a docshell that was loaded from a wyciwyg channel since the stored charset has no relationship to the original charset any more. r=bzbarsky@mit.edu, sr=darin@meer.net

git-svn-id: svn://10.0.0.236/trunk@156662 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%mozilla.jstenback.com
2004-05-20 22:47:20 +00:00
parent f5a0db9bb0
commit 24728ec446

View File

@@ -2114,18 +2114,32 @@ nsDocShell::AddChild(nsIDocShellTreeItem * aChild)
return NS_OK;
const nsACString &parentCS = doc->GetDocumentCharacterSet();
// set the child's parentCharset
nsCOMPtr<nsIAtom> parentCSAtom(do_GetAtom(parentCS));
res = dcInfo->SetParentCharset(parentCSAtom);
if (NS_FAILED(res))
return NS_OK;
PRBool isWyciwyg = PR_FALSE;
PRInt32 charsetSource = doc->GetDocumentCharacterSetSource();
if (mCurrentURI) {
// Check if the url is wyciwyg
mCurrentURI->SchemeIs("wyciwyg", &isWyciwyg);
}
// set the child's parentCharset
res = dcInfo->SetParentCharsetSource(charsetSource);
if (NS_FAILED(res))
return NS_OK;
if (!isWyciwyg) {
// If this docshell is loaded from a wyciwyg: URI, don't
// advertise our charset since it does not in any way reflect
// the actual source charset, which is what we're trying to
// expose here.
// set the child's parentCharset
nsCOMPtr<nsIAtom> parentCSAtom(do_GetAtom(parentCS));
res = dcInfo->SetParentCharset(parentCSAtom);
if (NS_FAILED(res))
return NS_OK;
PRInt32 charsetSource = doc->GetDocumentCharacterSetSource();
// set the child's parentCharset
res = dcInfo->SetParentCharsetSource(charsetSource);
if (NS_FAILED(res))
return NS_OK;
}
// printf("### 1 >>> Adding child. Parent CS = %s. ItemType = %d.\n", NS_LossyConvertUCS2toASCII(parentCS).get(), mItemType);