Fix for bug 89137. Remove autoconfig from preferences library. Patch by mitesh, r=bnesse/dmose. sr = alecf.

This commit is contained in:
bnesse%netscape.com 2001-12-21 22:29:31 +00:00
Родитель 9269c5db81
Коммит bf6619e295
17 изменённых файлов: 80 добавлений и 250 удалений

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

@ -1042,6 +1042,12 @@ for extension in $MOZ_EXTENSIONS; do
extensions/pics/src/Makefile
extensions/pics/tests/Makefile
" ;;
pref ) MAKEFILES_extensions="$MAKEFILES_extensions
extensions/pref/Makefile
extensions/pref/autoconfig/Makefile
extensions/pref/autoconfig/public/Makefile
extensions/pref/autoconfig/src/Makefile
" ;;
transformiix ) MAKEFILES_extensions="$MAKEFILES_extensions
$MAKEFILES_transformiix"
;;

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

@ -157,6 +157,12 @@ sub InstallDefaultsFiles()
}
}
{
my($default_autoconfig_dir) = "$defaults_dir"."autoconfig:";
mkdir($default_autoconfig_dir, 0);
InstallResources(":mozilla:extensions:pref:autoconfig:src:MANIFEST", "$default_autoconfig_dir");
}
print("--- Defaults copying complete ----\n");
}
@ -662,7 +668,7 @@ sub BuildClientDist()
InstallFromManifest(":mozilla:netwerk:mime:public:MANIFEST", "$distdirectory:netwerk:");
#EXTENSIONS
InstallFromManifest(":mozilla:extensions:cookie:MANIFEST_IDL", "$distdirectory:idl:");
InstallFromManifest(":mozilla:extensions:cookie:MANIFEST_IDL", "$distdirectory:idl:");
InstallFromManifest(":mozilla:extensions:cookie:MANIFEST", "$distdirectory:cookie:");
InstallFromManifest(":mozilla:extensions:wallet:public:MANIFEST", "$distdirectory:wallet:");
@ -1132,7 +1138,8 @@ sub BuildIDLProjects()
BuildIDLProject(":mozilla:embedding:browser:macbuild:browserIDL.xml", "embeddingbrowser");
BuildIDLProject(":mozilla:embedding:components:build:macbuild:EmbedComponentsIDL.xml", "EmbedComponents");
BuildIDLProject(":mozilla:extensions:cookie:macbuild:cookieIDL.xml", "cookie");
BuildIDLProject(":mozilla:extensions:cookie:macbuild:cookieIDL.xml", "cookie");
BuildIDLProject(":mozilla:extensions:pref:macbuild:prefextrasIDL.xml", "prefextras");
BuildIDLProject(":mozilla:extensions:wallet:macbuild:walletIDL.xml","wallet");
BuildIDLProject(":mozilla:extensions:xml-rpc:macbuild:xml-rpcIDL.xml","xml-rpc");
BuildIDLProject(":mozilla:xpfe:components:bookmarks:macbuild:BookmarksIDL.xml", "bookmarks");
@ -1539,6 +1546,7 @@ sub BuildBrowserUtilsProjects()
BuildOneProject(":mozilla:profile:pref-migrator:macbuild:prefmigrator.xml", "prefm$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:extensions:cookie:macbuild:cookie.xml", "Cookie$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:extensions:pref:macbuild:prefextras.xml", "prefExtras$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:extensions:wallet:macbuild:wallet.xml", "Wallet$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:extensions:wallet:macbuild:walletviewers.xml", "WalletViewers$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:extensions:universalchardet:macbuild:Universalchardet.xml", "Universalchardet$D.$S", 1, $main::ALIAS_SYM_FILES, 1);

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

@ -1281,7 +1281,16 @@ $(DIST)/bin/defaults/pref::
export:: $(PREF_JS_EXPORTS) $(DIST)/bin/defaults/pref
$(INSTALL) $(IFLAGS1) $^
endif
################################################################################
# Copy each element of AUTOCFG_JS_EXPORTS to $(DIST)/bin/defaults/autoconfig
ifneq ($(AUTOCFG_JS_EXPORTS),)
$(DIST)/bin/defaults/autoconfig::
@if test ! -d $@; then echo Creating $@; rm -rf $@; $(NSINSTALL) -D $@; else true; fi
export:: $(AUTOCFG_JS_EXPORTS) $(DIST)/bin/defaults/autoconfig
$(INSTALL) $(IFLAGS1) $^
endif
################################################################################
# Export the elements of $(XPIDLSRCS), generating .h and .xpt files and
# moving them to the appropriate places.

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

@ -31,6 +31,7 @@ DIRS = wallet \
!endif
content-packs \
help \
pref \
!if !defined(DISABLE_XSLT)
transformiix \
!endif

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

@ -987,13 +987,6 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsAutoConfig.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>prefapi.cpp</PATH>
@ -1058,11 +1051,6 @@
<PATH>nsPrefsFactory.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsAutoConfig.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>prefapi.cpp</PATH>
@ -2004,13 +1992,6 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsAutoConfig.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>prefapi.cpp</PATH>
@ -2075,11 +2056,6 @@
<PATH>nsPrefsFactory.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsAutoConfig.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>prefapi.cpp</PATH>
@ -2096,12 +2072,6 @@
<GROUPLIST>
<GROUP><NAME>libpref</NAME>
<FILEREF>
<TARGETNAME>libprefDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsAutoConfig.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>libprefDebug.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>

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

@ -307,7 +307,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -752,13 +752,6 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIAutoConfig.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -791,11 +784,6 @@
<PATH>nsIPrefService.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIAutoConfig.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
<TARGET>
@ -1052,7 +1040,7 @@
<!-- Settings for "FTP Panel" panel -->
<SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_password</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
@ -1497,13 +1485,6 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIAutoConfig.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
<FILEREF>
@ -1536,11 +1517,6 @@
<PATH>nsIPrefService.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIAutoConfig.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
</TARGETLIST>
@ -1551,12 +1527,6 @@
</TARGETORDER>
<GROUPLIST>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIAutoConfig.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>

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

@ -4,4 +4,3 @@
#[installed by xpidl] nsIPref.h
prefldap.h

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

@ -29,7 +29,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = pref
XPIDLSRCS = \
nsIAutoConfig.idl \
nsIPref.idl \
nsIPrefBranch.idl \
nsIPrefBranchInternal.idl \
@ -38,7 +37,5 @@ XPIDLSRCS = \
nsISecurityPref.idl \
$(NULL)
EXPORTS = prefldap.h
include $(topsrcdir)/config/rules.mk

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

@ -22,10 +22,8 @@
MODULE=pref
DEPTH=..\..\..
EXPORTS=prefldap.h
XPIDLSRCS = \
.\nsIAutoConfig.idl \
.\nsIPref.idl \
.\nsIPrefBranch.idl \
.\nsIPrefBranchInternal.idl \

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

@ -38,7 +38,6 @@ REQUIRES = xpcom \
caps \
intl \
necko \
profile \
$(NULL)
include $(topsrcdir)/config/config.mk
@ -47,7 +46,6 @@ CPPSRCS = nsPref.cpp \
nsPrefBranch.cpp \
nsPrefService.cpp \
nsPrefsFactory.cpp \
nsAutoConfig.cpp \
prefapi.cpp \
$(NULL)

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

@ -46,8 +46,6 @@ platform = new plat();
// stubs for compatibility
var default_pref = defaultPref;
var lock_pref = lockPref;
var unlock_pref = unlockPref;
var userPref = user_pref;
function mime_type(root, mimetype, extension, load_action, appname, appsig, filetype)

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

@ -37,31 +37,26 @@ DEPTH = ..\..\..
#//
#//------------------------------------------------------------------------
MODULE = pref
LIBRARY_NAME = xppref$(MOZ_BITS)
MODULE_NAME = nsPrefModule
REQUIRES = xpcom \
string \
js \
xpconnect \
caps \
intl \
necko \
profile \
$(NULL)
MODULE = pref
LIBRARY_NAME = xppref$(MOZ_BITS)
MODULE_NAME = nsPrefModule
REQUIRES = xpcom \
string \
js \
xpconnect \
caps \
intl \
necko \
$(NULL)
LCFLAGS = -DMOZILLA_CLIENT
!ifdef MOZ_SECURITY
HASHLIBS=$(DIST)\lib\hash.lib $(DIST)\lib\secutil.lib
!endif
LLIBS = \
$(LIBNSPR) \
$(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib \
$(DIST)\lib\xpcom.lib \
$(HASHLIBS)
$(DIST)\lib\xpcom.lib
#//------------------------------------------------------------------------
#//
@ -74,7 +69,6 @@ OBJS = \
.\$(OBJDIR)\nsPrefBranch.obj \
.\$(OBJDIR)\nsPrefService.obj \
.\$(OBJDIR)\nsPrefsFactory.obj \
.\$(OBJDIR)\nsAutoConfig.obj \
$(NULL)
#//------------------------------------------------------------------------

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

@ -52,7 +52,6 @@
#include "nsISupportsPrimitives.h"
#include "nsWeakReference.h"
#include "nsIJSRuntimeService.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"

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

@ -40,11 +40,11 @@
#include "jsapi.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
#include "nsICategoryManager.h"
#include "nsIFileStreams.h"
#include "nsIObserverService.h"
#include "nsPrefBranch.h"
#include "nsXPIDLString.h"
#include "nsIAutoConfig.h"
#include "nsQuickSort.h"
#include "prmem.h"
@ -71,8 +71,8 @@ class nsIFileSpec; // needed for prefapi_private_data.h inclusion
// Prototypes
static nsresult nsIFileToFileSpec(nsIFile* inFile, nsIFileSpec **aFileSpec);
static nsresult openPrefFile(nsIFile* aFile, PRBool aIsErrorFatal, PRBool aVerifyHash,
PRBool aIsGlobalContext, PRBool aSkipFirstLine);
static nsresult openPrefFile(nsIFile* aFile, PRBool aIsErrorFatal,
PRBool aIsGlobalContext, PRBool aSkipFirstLine);
static nsresult savePrefFile(nsIFile* aFile);
@ -127,25 +127,33 @@ NS_INTERFACE_MAP_END
nsresult nsPrefService::Init()
{
nsXPIDLCString lockFileName;
nsresult rv;
if (!PREF_Init(nsnull))
return NS_ERROR_FAILURE;
rv = readConfigFile();
if (NS_FAILED(rv))
return rv;
/*
* The following is a small hack which will allow us to only load the library
* which supports the netscape.cfg file if the preference is defined. We
* test for the existence of the pref, set in the all.js (mozilla) or
* all-ns.js (netscape 6), and if it exists we startup the pref config
* category which will do the rest.
*/
rv = mRootBranch->GetCharPref("general.config.filename", getter_Copies(lockFileName));
if (NS_SUCCEEDED(rv))
NS_CreateServicesFromCategory("pref-config-startup",
NS_STATIC_CAST(nsISupports *, NS_STATIC_CAST(void *, this)),
"pref-config-startup");
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1", &rv);
if (observerService) {
// Our refcnt must be > 0 when we call this, or we'll get deleted!
++mRefCnt;
rv = observerService->AddObserver(this, "profile-before-change", PR_TRUE);
if (NS_SUCCEEDED(rv)) {
rv = observerService->AddObserver(this, "profile-do-change", PR_TRUE);
}
--mRefCnt;
}
return(rv);
}
@ -180,7 +188,9 @@ NS_IMETHODIMP nsPrefService::ReadUserPrefs(nsIFile *aFile)
if (NS_SUCCEEDED(rv))
useUserPrefFile();
JS_MaybeGC(gMochaContext);
notifyObservers(NS_PREFSERVICE_READ_TOPIC_ID);
JS_MaybeGC(gMochaContext);
} else {
if (mCurrentFile == aFile)
return NS_OK;
@ -191,22 +201,20 @@ NS_IMETHODIMP nsPrefService::ReadUserPrefs(nsIFile *aFile)
gErrorOpeningUserPrefs = PR_FALSE;
rv = openPrefFile(mCurrentFile, PR_TRUE, PR_FALSE, PR_FALSE, PR_TRUE);
rv = openPrefFile(mCurrentFile, PR_TRUE, PR_FALSE, PR_TRUE);
}
return rv;
}
NS_IMETHODIMP nsPrefService::ResetPrefs()
{
nsresult rv;
notifyObservers(NS_PREFSERVICE_RESET_TOPIC_ID);
PREF_CleanupPrefs();
if (!PREF_Init(nsnull))
return NS_ERROR_FAILURE;
rv = readConfigFile();
return rv;
return NS_OK;
}
NS_IMETHODIMP nsPrefService::ResetUserPrefs()
@ -281,95 +289,17 @@ NS_IMETHODIMP nsPrefService::RemoveObserver(const char *aDomain, nsIObserver *aO
}
nsresult nsPrefService::readConfigFile()
nsresult nsPrefService::notifyObservers(const char *aTopic)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIFile> lockPrefFile;
nsXPIDLCString lockFileName;
nsXPIDLCString lockVendor;
/*
* This preference is set in the all.js or all-ns.js (depending whether
* running mozilla or netscp6) default - preference is commented out, so
* it doesn't exist.
*/
rv = mRootBranch->GetCharPref("general.config.filename",
getter_Copies(lockFileName));
if (NS_FAILED(rv)) {
/*
* if we got a "PREF_ERROR" back, the pref doesn't exist so, we ignore it
* - PREF_ERROR is converted to NS_ERROR_UNEXPECTED in _convertRes()
*/
if (rv == NS_ERROR_UNEXPECTED)
rv = NS_OK;
return rv;
}
rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
getter_AddRefs(lockPrefFile));
if (NS_SUCCEEDED(rv)) {
#ifdef XP_MAC
lockPrefFile->Append("Essential Files");
#endif
rv = lockPrefFile->Append(lockFileName);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
if (NS_FAILED(openPrefFile(lockPrefFile, PR_FALSE, PR_TRUE,
PR_FALSE, PR_TRUE)))
return NS_ERROR_FAILURE;
// failure here means problem within the config file script
}
/*
* Once the config file is read, we should check that the vendor name
* is consistent By checking for the vendor name after reading the config
* file we allow for the preference to be set (and locked) by the creator
* of the cfg file meaning the file can not be renamed (successfully).
*/
rv = mRootBranch->GetCharPref("general.config.filename",
getter_Copies(lockFileName));
if (NS_FAILED(rv)) // There is NO REASON this should fail.
return NS_ERROR_FAILURE;
rv = mRootBranch->GetCharPref("general.config.vendor",
getter_Copies(lockVendor));
/*
* If the "vendor" preference exists, do this simple check to add a
* level of security, albeit a small one, to the validation of the
* contents of the .cfg file.
*/
if (NS_SUCCEEDED(rv)) {
/*
* lockVendor and lockFileName should be the same with the addition of
* .cfg to the filename. By checking this post reading of the cfg file
* this value can, and should, be set within the cfg file adding a level
* of security.
*/
PRUint32 fileNameLen = PL_strlen(lockFileName);
if (PL_strncmp(lockFileName, lockVendor, fileNameLen -4) != 0)
return NS_ERROR_FAILURE;
}
nsresult rv;
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1", &rv);
// get the value of the autoconfig url
nsXPIDLCString urlName;
rv = mRootBranch->GetCharPref("autoadmin.global_config_url",
getter_Copies(urlName));
if (NS_SUCCEEDED(rv) && *urlName != '\0' ) {
// Instantiating nsAutoConfig object if the pref is present
nsCOMPtr<nsIAutoConfig> autocfg = do_CreateInstance(NS_AUTOCONFIG_CONTRACTID, &rv);
if (NS_FAILED(rv))
return NS_ERROR_OUT_OF_MEMORY;
rv = autocfg->SetConfigURL(urlName);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
}
if (NS_FAILED(rv) || !observerService)
return rv;
nsISupports *subject = (nsISupports *)((nsIPrefService *)this);
observerService->NotifyObservers(subject, aTopic, nsnull);
return NS_OK;
}
@ -398,7 +328,7 @@ nsresult nsPrefService::useDefaultPrefFile()
}
// need to save the prefs now
rv = SavePrefFile(aFile);
SavePrefFile(aFile);
return rv;
}
@ -414,14 +344,14 @@ nsresult nsPrefService::useUserPrefFile()
if (NS_SUCCEEDED(rv) && aFile) {
rv = aFile->Append(userFiles[0]);
if (NS_SUCCEEDED(rv)) {
rv = openPrefFile(aFile, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
rv = openPrefFile(aFile, PR_FALSE, PR_FALSE, PR_FALSE);
}
}
return rv;
}
static nsresult openPrefFile(nsIFile* aFile, PRBool aIsErrorFatal, PRBool aVerifyHash,
PRBool aIsGlobalContext, PRBool aSkipFirstLine)
static nsresult openPrefFile(nsIFile* aFile, PRBool aIsErrorFatal,
PRBool aIsGlobalContext, PRBool aSkipFirstLine)
{
nsCOMPtr<nsIInputStream> inStr;
char *readBuf;
@ -456,13 +386,6 @@ static nsresult openPrefFile(nsIFile* aFile, PRBool aIsErrorFatal, PRBool aVerif
rv = inStr->Read(readBuf, fileSize, &amtRead);
NS_ASSERTION((amtRead == fileSize), "failed to read the entire prefs file!!");
if (NS_SUCCEEDED(rv)) {
if (aVerifyHash) {
// Unobscure file by subtracting some value from every char - old value was 7
const int obscure_value = 13;
for (PRUint32 i = 0; i < amtRead; i++)
readBuf[i] -= obscure_value;
}
if (!PREF_EvaluateConfigScript(readBuf, amtRead, nsnull, aIsGlobalContext, PR_TRUE,
aSkipFirstLine))
{
@ -648,7 +571,7 @@ JSBool pref_InitInitialObjects()
if (NS_FAILED(rv))
return JS_FALSE;
rv = openPrefFile(aFile, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
rv = openPrefFile(aFile, PR_FALSE, PR_FALSE, PR_FALSE);
NS_ASSERTION(NS_SUCCEEDED(rv), "initpref.js not parsed successfully");
// Keep this child
@ -691,7 +614,7 @@ JSBool pref_InitInitialObjects()
int k;
for (k = 0; k < numFiles; k++) {
rv = openPrefFile(defaultPrefFiles[k], PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
rv = openPrefFile(defaultPrefFiles[k], PR_FALSE, PR_FALSE, PR_FALSE);
NS_ASSERTION(NS_SUCCEEDED(rv), "Config file not parsed successfully");
NS_RELEASE(defaultPrefFiles[k]);
}
@ -705,7 +628,7 @@ JSBool pref_InitInitialObjects()
if (NS_SUCCEEDED(rv)) {
rv = aFile->Append((char*)specialFiles[k]);
if (NS_SUCCEEDED(rv)) {
rv = openPrefFile(aFile, PR_FALSE, PR_FALSE, PR_FALSE, PR_FALSE);
rv = openPrefFile(aFile, PR_FALSE, PR_FALSE, PR_FALSE);
NS_ASSERTION(NS_SUCCEEDED(rv), "<platform>.js was not parsed successfully");
}
}

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

@ -64,9 +64,9 @@ public:
nsresult Init();
protected:
nsresult notifyObservers(const char *aSubject);
nsresult useDefaultPrefFile();
nsresult useUserPrefFile();
nsresult readConfigFile();
private:
nsCOMPtr<nsIPrefBranch> mRootBranch;

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

@ -40,7 +40,6 @@
#include "nsPrefService.h"
#include "nsPrefBranch.h"
#include "nsIPref.h"
#include "nsAutoConfig.h"
// remove this when nsPref goes away
extern NS_IMETHODIMP nsPrefConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult);
@ -48,9 +47,6 @@ extern NS_IMETHODIMP nsPrefConstructor(nsISupports *aOuter, REFNSIID aIID, void
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
// Factory constructor for nsAutoConfig. nsAutoConfig doesn't have a
//separate module so it is bundled with pref module.
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAutoConfig,Init)
// The list of components we register
static nsModuleComponentInfo components[] =
@ -75,12 +71,6 @@ static nsModuleComponentInfo components[] =
NS_PREF_CONTRACTID,
nsPrefConstructor
},
{
NS_AUTOCONFIG_CLASSNAME,
NS_AUTOCONFIG_CID,
NS_AUTOCONFIG_CONTRACTID,
nsAutoConfigConstructor
},
};
NS_IMPL_NSGETMODULE(nsPrefModule, components);

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

@ -103,8 +103,6 @@ matchPrefEntry(PLDHashTable*, const PLDHashEntryHdr* entry,
PR_STATIC_CALLBACK(JSBool) pref_NativeDefaultPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
PR_STATIC_CALLBACK(JSBool) pref_NativeUserPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
PR_STATIC_CALLBACK(JSBool) pref_NativeLockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
PR_STATIC_CALLBACK(JSBool) pref_NativeUnlockPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
PR_STATIC_CALLBACK(JSBool) pref_NativeSetConfig(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
PR_STATIC_CALLBACK(JSBool) pref_NativeGetPref(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval);
/*----------------------------------------------------------------------------------------*/
@ -150,8 +148,6 @@ static JSFunctionSpec autoconf_methods[] = {
{ "pref", pref_NativeDefaultPref, 2,0,0 },
{ "defaultPref", pref_NativeDefaultPref, 2,0,0 },
{ "user_pref", pref_NativeUserPref, 2,0,0 },
{ "lockPref", pref_NativeLockPref, 2,0,0 },
{ "unlockPref", pref_NativeUnlockPref, 1,0,0 },
{ "config", pref_NativeSetConfig, 2,0,0 },
{ "getPref", pref_NativeGetPref, 1,0,0 },
{ "localPref", pref_NativeDefaultPref, 1,0,0 },
@ -1053,30 +1049,6 @@ PR_STATIC_CALLBACK(JSBool) pref_NativeUserPref
return pref_HashJSPref(argc, argv, PREF_SETUSER);
}
PR_STATIC_CALLBACK(JSBool) pref_NativeLockPref
(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval)
{
return pref_HashJSPref(argc, argv, PREF_LOCK);
}
PR_STATIC_CALLBACK(JSBool) pref_NativeUnlockPref
(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval)
{
if (argc >= 1 && JSVAL_IS_STRING(argv[0]))
{
const char *key = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
PrefHashEntry* pref = pref_HashTableLookup(key);
if (pref && PREF_IS_LOCKED(pref))
{
pref->flags &= ~PREF_LOCKED;
if (gCallbacksEnabled)
pref_DoCallback(key);
}
}
return JS_TRUE;
}
PR_STATIC_CALLBACK(JSBool) pref_NativeSetConfig
(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval)
{
@ -1391,8 +1363,6 @@ static JSBool pref_HashJSPref(unsigned int argc, jsval *argv, PrefAction action)
pref -> pref_NativeDefaultPref
defaultPref -> "
userPref -> pref_NativeUserPref
lockPref -> pref_NativeLockPref
unlockPref -> pref_NativeUnlockPref
getPref -> pref_NativeGetPref
config -> pref_NativeSetConfig
*--------------------------------------------------------------------------------------*/