fix bug 5974 by passing parser command to nsWebShell

This commit is contained in:
ftang%netscape.com 1999-09-16 14:15:15 +00:00
Родитель feb49cdb74
Коммит 8714720398
3 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -176,6 +176,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
nsresult res = NS_OK;
PRUint32 i;
char command[256];
command[0]='\0';
// Only process if we get the HTTP-EQUIV=Content-Type in meta
// We totaly need 4 attributes
@ -183,6 +185,7 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
// CONTENT
// currentCharset - pseudo attribute fake by parser
// currentCharsetSource - pseudo attribute fake by parser
// X_COMMAND - pseudo attribute fake by parser
if((numOfAttributes >= 4) &&
(0 == nsCRT::strcasecmp(nameArray[0], "HTTP-EQUIV")) &&
@ -206,6 +209,9 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
} else if(0==nsCRT::strcmp(nameArray[i], "charsetSource")) {
bGotCharsetSource = PR_TRUE;
charsetSourceStr = valueArray[i];
} else if(0==nsCRT::strcmp(nameArray[i], "X_COMMAND")) {
nsAutoString tmp(valueArray[i]);
tmp.ToCString(command, 256);
}
}
@ -269,7 +275,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
{
const char* charsetInCStr = preferred.ToNewCString();
if(nsnull != charsetInCStr) {
res = NotifyWebShell(aDocumentID, charsetInCStr, kCharsetFromMetaTag );
res = NotifyWebShell(aDocumentID, charsetInCStr, kCharsetFromMetaTag ,
command[0]?command:nsnull);
delete [] (char*)charsetInCStr;
return res;
}

Просмотреть файл

@ -32,7 +32,8 @@ static NS_DEFINE_IID(kIWebShellServicesIID, NS_IWEB_SHELL_SERVICES_IID);
//-------------------------------------------------------------------------
NS_IMETHODIMP nsObserverBase::NotifyWebShell(
PRUint32 aDocumentID, const char* charset, nsCharsetSource source)
PRUint32 aDocumentID, const char* charset, nsCharsetSource source,
const char* aCmd)
{
nsresult res = NS_OK;
nsresult rv = NS_OK;
@ -75,7 +76,7 @@ NS_IMETHODIMP nsObserverBase::NotifyWebShell(
goto done;
}
if(NS_FAILED(rv = wss->ReloadDocument(charset, source))) {
if(NS_FAILED(rv = wss->ReloadDocument(charset, source, aCmd))) {
rv = wss->SetRendering(PR_TRUE); // turn on the rendering so at least we will see something.
goto done;
}

Просмотреть файл

@ -42,7 +42,10 @@ public:
*/
protected:
NS_IMETHOD NotifyWebShell(PRUint32 aDocumentID, const char* charset, nsCharsetSource source);
NS_IMETHOD NotifyWebShell(PRUint32 aDocumentID,
const char* charset,
nsCharsetSource source,
const char* aCmd = nsnull);
};