Partial fix for 66020: /r=valeski; /sr=alecf

This commit is contained in:
yokoyama%netscape.com 2001-04-14 00:31:09 +00:00
Родитель 00eb0db383
Коммит 2ab7b9f9d0
4 изменённых файлов: 32 добавлений и 36 удалений

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

@ -39,6 +39,8 @@
#include "nsIWebShellServices.h" #include "nsIWebShellServices.h"
#include "nsIStringCharsetDetector.h" #include "nsIStringCharsetDetector.h"
#include "nsIGenericFactory.h" #include "nsIGenericFactory.h"
#include "nsIAppStartupNotifier.h"
#include "nsICategoryManager.h"
#include "nsMetaCharsetObserver.h" #include "nsMetaCharsetObserver.h"
#include "nsXMLEncodingObserver.h" #include "nsXMLEncodingObserver.h"
#include "nsDetectionAdaptor.h" #include "nsDetectionAdaptor.h"
@ -110,6 +112,24 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(ns2ndBlkDbgDetector);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLastBlkDbgDetector); NS_GENERIC_FACTORY_CONSTRUCTOR(nsLastBlkDbgDetector);
#endif /* INCLUDE_DBGDETECTOR */ #endif /* INCLUDE_DBGDETECTOR */
static NS_METHOD nsMetaCharsetObserverRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)
{
nsresult rv;
nsCOMPtr<nsICategoryManager>
categoryManager(do_GetService("@mozilla.org/categorymanager;1", &rv));
if (NS_SUCCEEDED(rv)) {
rv = categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "Meta Charset",
"service," NS_META_CHARSET_CONTRACTID,
PR_TRUE, PR_TRUE,
nsnull);
}
return rv;
}
static NS_METHOD nsDetectionAdaptorRegistrationProc(nsIComponentManager *aCompMgr, static NS_METHOD nsDetectionAdaptorRegistrationProc(nsIComponentManager *aCompMgr,
nsIFile *aPath, nsIFile *aPath,
const char *registryLocation, const char *registryLocation,
@ -377,7 +397,7 @@ static nsModuleComponentInfo components[] =
{ {
{ "Meta Charset", NS_META_CHARSET_CID, { "Meta Charset", NS_META_CHARSET_CID,
NS_META_CHARSET_CONTRACTID, nsMetaCharsetObserverConstructor, NS_META_CHARSET_CONTRACTID, nsMetaCharsetObserverConstructor,
NULL, NULL}, nsMetaCharsetObserverRegistrationProc, NULL},
{ "Document Charset Info", NS_DOCUMENTCHARSETINFO_CID, { "Document Charset Info", NS_DOCUMENTCHARSETINFO_CID,
NS_DOCUMENTCHARSETINFO_CONTRACTID, nsDocumentCharsetInfoConstructor, NS_DOCUMENTCHARSETINFO_CONTRACTID, nsDocumentCharsetInfoConstructor,
NULL, NULL}, NULL, NULL},

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

@ -29,6 +29,7 @@
#include "nsISupports.h" #include "nsISupports.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "nsIParser.h" #include "nsIParser.h"
#include "nsIAppStartupNotifier.h"
#include "pratom.h" #include "pratom.h"
#include "nsCharDetDll.h" #include "nsCharDetDll.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
@ -256,10 +257,17 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_IMETHODIMP nsMetaCharsetObserver::Observe(nsISupports*, const PRUnichar*, const PRUnichar*) NS_IMETHODIMP nsMetaCharsetObserver::Observe(nsISupports *aSubject,
const PRUnichar *aTopic,
const PRUnichar *aData)
{ {
return NS_ERROR_NOT_IMPLEMENTED; nsresult rv = NS_OK;
} nsLiteralString aTopicString(aTopic);
if (aTopicString.Equals(NS_LITERAL_STRING(APPSTARTUP_CATEGORY))) //"app_startup"
rv = Start();
return rv;
}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_IMETHODIMP nsMetaCharsetObserver::Start() NS_IMETHODIMP nsMetaCharsetObserver::Start()
{ {

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

@ -65,9 +65,6 @@
#include "nsIDOMHTMLSelectElement.h" #include "nsIDOMHTMLSelectElement.h"
// Charset converter
#include "nsMetaCharsetCID.h"
#include "nsIMetaCharsetService.h"
// new widget stuff // new widget stuff
#ifdef USE_LOCAL_WIDGETS #ifdef USE_LOCAL_WIDGETS
@ -113,9 +110,6 @@ static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID); static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID);
static NS_DEFINE_IID(kMetaCharsetCID, NS_META_CHARSET_CID);
static NS_DEFINE_IID(kIMetaCharsetServiceIID, NS_IMETA_CHARSET_SERVICE_IID);
static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID); static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID);
static NS_DEFINE_IID(kIDOMHTMLSelectElementIID, NS_IDOMHTMLSELECTELEMENT_IID); static NS_DEFINE_IID(kIDOMHTMLSelectElementIID, NS_IDOMHTMLSELECTELEMENT_IID);
@ -179,8 +173,6 @@ nsViewerApp::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
void void
nsViewerApp::Destroy() nsViewerApp::Destroy()
{ {
nsresult rv;
// Close all of our windows // Close all of our windows
nsBrowserWindow::CloseAllWindows(); nsBrowserWindow::CloseAllWindows();
@ -191,11 +183,6 @@ nsViewerApp::Destroy()
NS_RELEASE(mCrawler); NS_RELEASE(mCrawler);
} }
NS_WITH_SERVICE(nsIMetaCharsetService, metacharset, kMetaCharsetCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = metacharset->End();
}
if (nsnull != mPrefs) { if (nsnull != mPrefs) {
mPrefs->ShutDown(); mPrefs->ShutDown();
NS_RELEASE(mPrefs); NS_RELEASE(mPrefs);
@ -266,11 +253,6 @@ nsViewerApp::SetupRegistry()
NS_SetupRegistry(); NS_SetupRegistry();
NS_WITH_SERVICE(nsIMetaCharsetService, metacharset, kMetaCharsetCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = metacharset->Start();
}
// Register our browser window factory // Register our browser window factory
nsIFactory* bwf; nsIFactory* bwf;
NS_NewXPBaseWindowFactory(&bwf); NS_NewXPBaseWindowFactory(&bwf);

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

@ -55,9 +55,6 @@
#include "nsWidgetsCID.h" #include "nsWidgetsCID.h"
#include "nsIRequestObserver.h" #include "nsIRequestObserver.h"
#include "nsMetaCharsetCID.h"
#include "nsIMetaCharsetService.h"
/* For implementing GetHiddenWindowAndJSContext */ /* For implementing GetHiddenWindowAndJSContext */
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "jsapi.h" #include "jsapi.h"
@ -68,7 +65,6 @@
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
static NS_DEFINE_CID(kMetaCharsetCID, NS_META_CHARSET_CID);
static NS_DEFINE_CID(kXPConnectCID, NS_XPCONNECT_CID); static NS_DEFINE_CID(kXPConnectCID, NS_XPCONNECT_CID);
// copied from nsEventQueue.cpp // copied from nsEventQueue.cpp
@ -136,22 +132,12 @@ nsAppShellService::Initialize( nsICmdLineService *aCmdLineService,
mSplashScreen = do_QueryInterface( aNativeAppSupportOrSplashScreen ); mSplashScreen = do_QueryInterface( aNativeAppSupportOrSplashScreen );
} }
NS_WITH_SERVICE(nsIMetaCharsetService, metacharset, kMetaCharsetCID, &rv);
if(NS_FAILED(rv)) {
goto done;
}
// Create the toplevel window list... // Create the toplevel window list...
rv = NS_NewISupportsArray(getter_AddRefs(mWindowList)); rv = NS_NewISupportsArray(getter_AddRefs(mWindowList));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
goto done; goto done;
} }
rv = metacharset->Start();
if(NS_FAILED(rv)) {
goto done;
}
// Create widget application shell // Create widget application shell
rv = nsComponentManager::CreateInstance(kAppShellCID, nsnull, rv = nsComponentManager::CreateInstance(kAppShellCID, nsnull,
NS_GET_IID(nsIAppShell), NS_GET_IID(nsIAppShell),