back myself out to see if I'm causing orange

This commit is contained in:
alecf%netscape.com 2001-02-13 04:08:26 +00:00
Родитель 68b477920d
Коммит 689df1b0a2
4 изменённых файлов: 37 добавлений и 46 удалений

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

@ -237,7 +237,6 @@ nsPref::nsPref()
++mRefCnt;
rv = observerService->AddObserver(this, PROFILE_BEFORE_CHANGE_TOPIC);
rv = observerService->AddObserver(this, PROFILE_DO_CHANGE_TOPIC);
rv = observerService->AddObserver(this, NS_ConvertASCIItoUCS2(NS_XPCOM_SHUTDOWN_OBSERVER_ID).get());
--mRefCnt;
}
}
@ -639,7 +638,7 @@ NotifyObserver(const char *newpref, void *data)
{
nsCOMPtr<nsIObserver> observer = NS_STATIC_CAST(nsIObserver *, data);
observer->Observe(observer, NS_LITERAL_STRING("nsPref:changed"),
NS_ConvertASCIItoUCS2(newpref).get());
NS_ConvertASCIItoUCS2(newpref));
return 0;
}
@ -845,7 +844,7 @@ NS_IMETHODIMP nsPref::SetCharPref(const char *pref,const char* value)
NS_IMETHODIMP nsPref::SetUnicharPref(const char *pref, const PRUnichar *value)
{
if (NS_FAILED(SecurePrefCheck(pref))) return NS_ERROR_FAILURE;
return SetCharPref(pref, NS_ConvertUCS2toUTF8(value).get());
return SetCharPref(pref, NS_ConvertUCS2toUTF8(value));
}
NS_IMETHODIMP nsPref::SetIntPref(const char *pref,PRInt32 value)
@ -908,7 +907,7 @@ NS_IMETHODIMP nsPref::SetDefaultUnicharPref(const char *pref,
const PRUnichar *value)
{
if (NS_FAILED(SecurePrefCheck(pref))) return NS_ERROR_FAILURE;
return SetDefaultCharPref(pref, NS_ConvertUCS2toUTF8(value).get());
return SetDefaultCharPref(pref, NS_ConvertUCS2toUTF8(value));
}
NS_IMETHODIMP nsPref::SetDefaultIntPref(const char *pref,PRInt32 value)
@ -1496,11 +1495,6 @@ NS_IMETHODIMP nsPref::Observe(nsISupports *aSubject, const PRUnichar *aTopic, co
PREF_ClearAllUserPrefs();
rv = ReadUserPrefs();
}
else if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
// we're shutting down now, so we need to clean up and
// eliminate our reference to the JS runtime
PREF_CleanupJSState();
}
return rv;
}

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

@ -153,6 +153,7 @@ global_resolve(JSContext *cx, JSObject *obj, jsval id)
return JS_ResolveStandardClass(cx, obj, id, &resolved);
}
JSTaskState * gMochaTaskState = NULL;
JSContext * gMochaContext = NULL;
JSObject * gMochaPrefObject = NULL;
JSObject * gGlobalConfigObject = NULL;
@ -409,7 +410,6 @@ PRBool PREF_Init(const char *filename)
{
PRBool ok = PR_TRUE;
extern JSRuntime* PREF_GetJSRuntime(void);
JSTaskState * mochaTaskState = NULL;
/* --ML hash test */
if (!gHashTable)
@ -427,11 +427,12 @@ PRBool PREF_Init(const char *filename)
}
#endif /* PREF_SUPPORT_OLD_PATH_STRINGS */
mochaTaskState = PREF_GetJSRuntime();
if (!gMochaTaskState)
gMochaTaskState = PREF_GetJSRuntime();
if (!gMochaContext)
{
gMochaContext = JS_NewContext(mochaTaskState, 8192); /* ???? What size? */
gMochaContext = JS_NewContext(gMochaTaskState, 8192); /* ???? What size? */
if (!gMochaContext)
return PR_FALSE;
@ -537,7 +538,19 @@ void PREF_Cleanup()
/* Frees up all the objects except the callback list. */
void PREF_CleanupPrefs()
{
PREF_CleanupJSState();
gMochaTaskState = NULL; /* We -don't- destroy this. */
if (gMochaContext) {
gMochaPrefObject = NULL;
if (gGlobalConfigObject) {
JS_SetGlobalObject(gMochaContext, NULL);
gGlobalConfigObject = NULL;
}
JS_DestroyContext(gMochaContext);
gMochaContext = NULL;
}
if (gHashTable)
PR_HashTableDestroy(gHashTable);
@ -554,19 +567,6 @@ void PREF_CleanupPrefs()
#endif
}
/* cleans out JSContexts, etc, that were used to read in prefs.js & friends */
void PREF_CleanupJSState()
{
if (gMochaContext) {
gMochaPrefObject = NULL;
gGlobalConfigObject = NULL;
JS_DestroyContext(gMochaContext);
gMochaContext = NULL;
}
}
PrefResult
PREF_ReadLockFile(const char *filename)
{

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

@ -153,6 +153,7 @@ global_resolve(JSContext *cx, JSObject *obj, jsval id)
return JS_ResolveStandardClass(cx, obj, id, &resolved);
}
JSTaskState * gMochaTaskState = NULL;
JSContext * gMochaContext = NULL;
JSObject * gMochaPrefObject = NULL;
JSObject * gGlobalConfigObject = NULL;
@ -409,7 +410,6 @@ PRBool PREF_Init(const char *filename)
{
PRBool ok = PR_TRUE;
extern JSRuntime* PREF_GetJSRuntime(void);
JSTaskState * mochaTaskState = NULL;
/* --ML hash test */
if (!gHashTable)
@ -427,11 +427,12 @@ PRBool PREF_Init(const char *filename)
}
#endif /* PREF_SUPPORT_OLD_PATH_STRINGS */
mochaTaskState = PREF_GetJSRuntime();
if (!gMochaTaskState)
gMochaTaskState = PREF_GetJSRuntime();
if (!gMochaContext)
{
gMochaContext = JS_NewContext(mochaTaskState, 8192); /* ???? What size? */
gMochaContext = JS_NewContext(gMochaTaskState, 8192); /* ???? What size? */
if (!gMochaContext)
return PR_FALSE;
@ -537,7 +538,19 @@ void PREF_Cleanup()
/* Frees up all the objects except the callback list. */
void PREF_CleanupPrefs()
{
PREF_CleanupJSState();
gMochaTaskState = NULL; /* We -don't- destroy this. */
if (gMochaContext) {
gMochaPrefObject = NULL;
if (gGlobalConfigObject) {
JS_SetGlobalObject(gMochaContext, NULL);
gGlobalConfigObject = NULL;
}
JS_DestroyContext(gMochaContext);
gMochaContext = NULL;
}
if (gHashTable)
PR_HashTableDestroy(gHashTable);
@ -554,19 +567,6 @@ void PREF_CleanupPrefs()
#endif
}
/* cleans out JSContexts, etc, that were used to read in prefs.js & friends */
void PREF_CleanupJSState()
{
if (gMochaContext) {
gMochaPrefObject = NULL;
gGlobalConfigObject = NULL;
JS_DestroyContext(gMochaContext);
gMochaContext = NULL;
}
}
PrefResult
PREF_ReadLockFile(const char *filename)
{

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

@ -145,9 +145,6 @@ PREF_Cleanup();
void
PREF_CleanupPrefs();
void
PREF_CleanupJSState();
/*
// <font color=blue>
// Given a path to a local Lock file, unobscures the file (not implemented yet)