From e8bca109140796092db79e89533351c291f528ea Mon Sep 17 00:00:00 2001 From: "shanjian%netscape.com" Date: Thu, 23 Aug 2001 04:24:25 +0000 Subject: [PATCH] #45187 Inherit character coding does not work in r = rpotts, sr=waterson, a=tor git-svn-id: svn://10.0.0.236/trunk@101688 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 207674c9d2f..b2cad7b138d 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -942,6 +942,24 @@ nsresult nsDocShell::FindTarget(const PRUnichar *aWindowTarget, // If all went well, indicate that a new window has been created. if (*aResult) { *aIsNewWindow = PR_TRUE; + + // if we just open a new window for this link, charset from current docshell + // should be kept, as what we did in js openNewWindowWith(url) + nsCOMPtr muCV, target_muCV; + nsCOMPtr cv, target_cv; + this->GetContentViewer(getter_AddRefs(cv)); + (*aResult)->GetContentViewer(getter_AddRefs(target_cv)); + if (cv && target_cv) { + muCV = do_QueryInterface(cv); + target_muCV = do_QueryInterface(target_cv); + if (muCV && target_muCV) { + nsXPIDLString defaultCharset; + rv = muCV->GetDefaultCharacterSet(getter_Copies(defaultCharset)); + if(NS_SUCCEEDED(rv)) { + target_muCV->SetDefaultCharacterSet(defaultCharset); + } + } + } } return rv;