From 24728ec446cd322a28f088cb72a3864fd54aa875 Mon Sep 17 00:00:00 2001 From: "jst%mozilla.jstenback.com" Date: Thu, 20 May 2004 22:47:20 +0000 Subject: [PATCH] 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 --- mozilla/docshell/base/nsDocShell.cpp | 34 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 6de02ebb159..8afc4115d8c 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -2114,18 +2114,32 @@ nsDocShell::AddChild(nsIDocShellTreeItem * aChild) return NS_OK; const nsACString &parentCS = doc->GetDocumentCharacterSet(); - // set the child's parentCharset - nsCOMPtr 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 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);