Back out ftang's changes to fix show stopper on mailnews: Bug #6740. Right now mailnews is helpless without backing this out.
git-svn-id: svn://10.0.0.236/trunk@32378 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -308,9 +308,6 @@ nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
|
||||
|
||||
nsAutoString charset = "ISO-8859-1"; // fallback value in case webShell return error
|
||||
nsCharsetSource charsetSource = kCharsetFromDocTypeDefault;
|
||||
const PRUnichar* requestCharset = nsnull;
|
||||
nsCharsetSource requestCharsetSource = kCharsetUninitialized;
|
||||
|
||||
|
||||
#ifdef rickgdebug
|
||||
nsString outString; // added out. Redirect to stdout if desired -- gpk 04/01/99
|
||||
@@ -327,12 +324,6 @@ nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
|
||||
charset = defaultCharsetFromWebShell;
|
||||
charsetSource = kCharsetFromUserDefault;
|
||||
}
|
||||
// for html, we need to find out the Meta tag from the hint.
|
||||
rv = webShell->GetCharacterSetHint(&requestCharset, &requestCharsetSource);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
if(requestCharsetSource > charsetSource)
|
||||
charset = requestCharset;
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(webShell);
|
||||
#endif
|
||||
@@ -340,6 +331,8 @@ nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
|
||||
// XXXX
|
||||
// We should take care two more cases here
|
||||
// 1. The charset attribute from HTTP header
|
||||
// 2. The charset parameter from the META Tag -
|
||||
// which explicit pass to nsWebShell from nsCharsetObserver
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = this->SetDocumentCharacterSet(charset);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "nsICharsetAlias.h"
|
||||
#undef NS_IMPL_IDS
|
||||
|
||||
//#define DONT_INFORM_WEBSHELL
|
||||
#define DONT_INFORM_WEBSHELL
|
||||
|
||||
#include "nsMetaCharsetObserver.h"
|
||||
#include "nsIMetaCharsetService.h"
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIWebShellServices.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
|
||||
static NS_DEFINE_IID(kIElementObserverIID, NS_IELEMENTOBSERVER_IID);
|
||||
@@ -45,6 +46,7 @@ static NS_DEFINE_IID(kIMetaCharsetServiceIID, NS_IMETA_CHARSET_SERVICE_IID);
|
||||
static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID);
|
||||
static NS_DEFINE_IID(kIDocumentLoaderIID, NS_IDOCUMENTLOADER_IID);
|
||||
static NS_DEFINE_IID(kIWebShellServicesIID, NS_IWEB_SHELL_SERVICES_IID);
|
||||
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||
//==========================================================================
|
||||
//
|
||||
// Class declaration for the class
|
||||
@@ -283,7 +285,12 @@ NS_IMETHODIMP nsMetaCharsetObserver::NotifyWebShell(
|
||||
nsIDocumentLoader * docLoader = nsnull;
|
||||
nsIContentViewerContainer * cvc = nsnull;
|
||||
nsIWebShellServices* wss = nsnull;
|
||||
|
||||
nsIWebShell* iws = nsnull;
|
||||
const PRUnichar* theURL = nsnull;
|
||||
PRInt32 historyIdx = -1;
|
||||
nsAutoString urlStr;
|
||||
const char* urlCStr = nsnull;
|
||||
|
||||
if(NS_FAILED(res =nsServiceManager::GetService(kDocLoaderServiceCID,
|
||||
kIDocumentLoaderIID,
|
||||
(nsISupports**)&docLoader)))
|
||||
@@ -295,6 +302,23 @@ NS_IMETHODIMP nsMetaCharsetObserver::NotifyWebShell(
|
||||
if(NS_FAILED( res = cvc->QueryInterface(kIWebShellServicesIID, (void**)&wss)))
|
||||
goto done;
|
||||
|
||||
if(NS_FAILED( res = wss->QueryInterface(kIWebShellIID, (void**)&iws)))
|
||||
goto done;
|
||||
|
||||
|
||||
if(NS_FAILED( res = iws->GetHistoryIndex(historyIdx) ))
|
||||
goto done;
|
||||
|
||||
// ask the webshelle about the current URL
|
||||
if(NS_FAILED( res = iws->GetURL(historyIdx, &theURL) ))
|
||||
goto done;
|
||||
|
||||
// convert the PRUnichar* to const char*
|
||||
urlStr = theURL;
|
||||
urlCStr = urlStr.ToNewCString();
|
||||
if(nsnull == urlCStr)
|
||||
goto done;
|
||||
|
||||
#ifndef DONT_INFORM_WEBSHELL
|
||||
// ask the webshellservice to load the URL
|
||||
if(NS_FAILED( res = wss->SetRendering(PR_TRUE) ))
|
||||
@@ -303,14 +327,18 @@ NS_IMETHODIMP nsMetaCharsetObserver::NotifyWebShell(
|
||||
if(NS_FAILED(res = wss->StopDocumentLoad()))
|
||||
goto done;
|
||||
|
||||
if(NS_FAILED(res = wss->ReloadDocument(charset, source)))
|
||||
if(NS_FAILED(res = wss->LoadDocument(urlCStr, charset, source)))
|
||||
goto done;
|
||||
|
||||
#endif
|
||||
done:
|
||||
if(urlCStr) {
|
||||
delete [] (char*) urlCStr;
|
||||
}
|
||||
if(docLoader) {
|
||||
nsServiceManager::ReleaseService(kDocLoaderServiceCID,docLoader);
|
||||
}
|
||||
NS_IF_RELEASE(iws);
|
||||
NS_IF_RELEASE(cvc);
|
||||
NS_IF_RELEASE(wss);
|
||||
return res;
|
||||
|
||||
@@ -308,9 +308,6 @@ nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
|
||||
|
||||
nsAutoString charset = "ISO-8859-1"; // fallback value in case webShell return error
|
||||
nsCharsetSource charsetSource = kCharsetFromDocTypeDefault;
|
||||
const PRUnichar* requestCharset = nsnull;
|
||||
nsCharsetSource requestCharsetSource = kCharsetUninitialized;
|
||||
|
||||
|
||||
#ifdef rickgdebug
|
||||
nsString outString; // added out. Redirect to stdout if desired -- gpk 04/01/99
|
||||
@@ -327,12 +324,6 @@ nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
|
||||
charset = defaultCharsetFromWebShell;
|
||||
charsetSource = kCharsetFromUserDefault;
|
||||
}
|
||||
// for html, we need to find out the Meta tag from the hint.
|
||||
rv = webShell->GetCharacterSetHint(&requestCharset, &requestCharsetSource);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
if(requestCharsetSource > charsetSource)
|
||||
charset = requestCharset;
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(webShell);
|
||||
#endif
|
||||
@@ -340,6 +331,8 @@ nsHTMLDocument::StartDocumentLoad(nsIURL *aURL,
|
||||
// XXXX
|
||||
// We should take care two more cases here
|
||||
// 1. The charset attribute from HTTP header
|
||||
// 2. The charset parameter from the META Tag -
|
||||
// which explicit pass to nsWebShell from nsCharsetObserver
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = this->SetDocumentCharacterSet(charset);
|
||||
|
||||
Reference in New Issue
Block a user