Change nsJSProtocolHandler to listen to originCharset to apply conversion if necessary,

also changed the callers to set originCharset,
bug 137182, r=caillon, sr=jst, a=asa.


git-svn-id: svn://10.0.0.236/trunk@125650 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nhotta%netscape.com
2002-07-23 23:28:28 +00:00
parent eaa75bb394
commit 7da2a94cbd
4 changed files with 94 additions and 22 deletions

View File

@@ -575,11 +575,27 @@ nsWebShell::OnLinkClickSync(nsIContent *aContent,
// Fall through, this seems like the most reasonable action
case eLinkVerb_Replace:
{
// get a charset of the document and use is as originCharset
nsAutoString docCharset;
nsCOMPtr<nsIPresShell> presShell;
nsDocShell::GetPresShell(getter_AddRefs(presShell));
if (presShell)
{
nsCOMPtr<nsIDocument> doc;
presShell->GetDocument(getter_AddRefs(doc));
if (doc &&
NS_FAILED(doc->GetDocumentCharacterSet(docCharset)))
docCharset.Truncate();
}
// for now, just hack the verb to be view-link-clicked
// and down in the load document code we'll detect this and
// set the correct uri loader command
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), nsDependentString(aURLSpec), nsnull);
NS_NewURI(getter_AddRefs(uri), nsDependentString(aURLSpec),
docCharset.IsEmpty()
? nsnull
: NS_LossyConvertUCS2toASCII(docCharset).get());
// No URI object? This may indicate the URLspec is for an
// unrecognized protocol. Embedders might still be interested