Freezes the nsIProperties interface. 162114. r=ccarlen, sr=alecf. Freezes the mozIJSSubScriptLoader interface. 157136. r=rginda, sr=alec.

This commit is contained in:
dougt%netscape.com 2002-08-26 20:36:44 +00:00
Родитель 9159fc3cae
Коммит 4f8934ad1d
13 изменённых файлов: 79 добавлений и 153 удалений

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

@ -825,7 +825,7 @@ mozSanitizingHTMLSerializer::ParseTagPref(const nsCAutoString& tagpref)
#ifdef DEBUG_BenB
printf(" Processing attr -%s-\n", iAttr);
#endif
attr_bag->Define(iAttr, 0);
attr_bag->Set(iAttr, 0);
}
nsIProperties* attr_bag_raw = attr_bag;

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

@ -35,6 +35,10 @@
#include "nsISupports.idl"
/*
* @status FROZEN
*/
[scriptable, uuid(8792d77e-1dd2-11b2-ac7f-9bc9be4f2916)]
interface mozIJSSubScriptLoader : nsISupports
{

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

@ -42,7 +42,6 @@
#include "nsIXPConnect.h"
#include "nsCRT.h"
#include "nsMemory.h"
#include "nsIRegistry.h"
#include "nsXPIDLString.h"
#include "nsIObserverService.h"
#include "nsIXPCScriptable.h"
@ -394,7 +393,6 @@ mozJSComponentLoader::mozJSComponentLoader()
: mRuntime(nsnull),
mModules(nsnull),
mGlobals(nsnull),
mXPCOMKey(0),
mInitialized(PR_FALSE)
{
NS_INIT_REFCNT();
@ -486,15 +484,6 @@ mozJSComponentLoader::Init(nsIComponentManager *aCompMgr, nsISupports *aReg)
if (NS_FAILED(rv))
return rv;
/* initialize registry handles */
mRegistry = do_QueryInterface(aReg, &rv);
if (NS_SUCCEEDED(rv)) {
rv = mRegistry->GetSubtree(nsIRegistry::Common, JSxpcomKeyName,
&mXPCOMKey);
if (NS_FAILED(rv))
/* if we can't get the XPCOM key, just skip all registry ops */
mRegistry = nsnull;
}
return NS_OK;
}
@ -627,7 +616,6 @@ mozJSComponentLoader::SetRegistryInfo(const char *registryLocation,
nsresult
mozJSComponentLoader::RemoveRegistryInfo(nsIFile *component, const char *registryLocation)
{
nsresult rv;
if (!mLoaderManager)
return NS_ERROR_FAILURE;
@ -639,7 +627,6 @@ PRBool
mozJSComponentLoader::HasChanged(const char *registryLocation,
nsIFile *component)
{
nsresult rv;
if (!mLoaderManager)
return NS_ERROR_FAILURE;

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

@ -22,7 +22,6 @@
#include "nsIComponentLoaderManager.h"
#include "nsIJSRuntimeService.h"
#include "nsIJSContextStack.h"
#include "nsIRegistry.h"
#include "nsISupports.h"
#include "nsIXPConnect.h"
#include "nsIModule.h"
@ -63,7 +62,6 @@ public:
nsCOMPtr<nsIComponentManager> mCompMgr;
nsCOMPtr<nsIComponentLoaderManager> mLoaderManager;
nsCOMPtr<nsIRegistry> mRegistry;
nsCOMPtr<nsIJSRuntimeService> mRuntimeService;
#ifndef XPCONNECT_STANDALONE
nsCOMPtr<nsIPrincipal> mSystemPrincipal;
@ -71,7 +69,6 @@ public:
JSRuntime *mRuntime;
PLHashTable *mModules;
PLHashTable *mGlobals;
nsRegistryKey mXPCOMKey;
PRBool mInitialized;
nsSupportsArray mDeferredComponents;

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

@ -529,28 +529,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid )
switch ( (nsWellKnownRegistry) regid ) {
case ApplicationComponentRegistry:
{
// can't use NS_GetSpecialDirectory here. Called before service manager is initialized.
nsCOMPtr<nsIProperties> directoryService;
rv = nsDirectoryService::Create(nsnull,
NS_GET_IID(nsIProperties),
getter_AddRefs(directoryService));
if (NS_FAILED(rv)) return rv;
directoryService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE, NS_GET_IID(nsIFile),
getter_AddRefs(registryLocation));
if (registryLocation)
{
foundReg = PR_TRUE;
rv = registryLocation->GetNativePath(regFile); // dougt fix...
// dveditz needs to fix his registry so that I can pass an
// nsIFile interface and not hack
if (NS_FAILED(rv))
return rv;
}
}
NS_WARNING("ApplicationComponentRegistry is unsupported!");
break;
case ApplicationRegistry:
{

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

@ -2133,8 +2133,7 @@ nsProfile::DefineLocaleDefaultsDir()
if (NS_SUCCEEDED(rv))
rv = localeDefaults->AppendNative(localeName);
}
(void) directoryService->Undefine(NS_APP_PROFILE_DEFAULTS_50_DIR);
rv = directoryService->Define(NS_APP_PROFILE_DEFAULTS_50_DIR, localeDefaults);
rv = directoryService->Set(NS_APP_PROFILE_DEFAULTS_50_DIR, localeDefaults);
}
return rv;
}

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

@ -428,7 +428,7 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
rv = binDirectory->IsDirectory(&value);
if (NS_SUCCEEDED(rv) && value)
gDirectoryService->Define(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory);
gDirectoryService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory);
//Since people are still using the nsSpecialSystemDirectory, we should init it.
nsCAutoString path;

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

@ -529,28 +529,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid )
switch ( (nsWellKnownRegistry) regid ) {
case ApplicationComponentRegistry:
{
// can't use NS_GetSpecialDirectory here. Called before service manager is initialized.
nsCOMPtr<nsIProperties> directoryService;
rv = nsDirectoryService::Create(nsnull,
NS_GET_IID(nsIProperties),
getter_AddRefs(directoryService));
if (NS_FAILED(rv)) return rv;
directoryService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE, NS_GET_IID(nsIFile),
getter_AddRefs(registryLocation));
if (registryLocation)
{
foundReg = PR_TRUE;
rv = registryLocation->GetNativePath(regFile); // dougt fix...
// dveditz needs to fix his registry so that I can pass an
// nsIFile interface and not hack
if (NS_FAILED(rv))
return rv;
}
}
NS_WARNING("ApplicationComponentRegistry is unsupported!");
break;
case ApplicationRegistry:
{

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

@ -37,15 +37,33 @@
#include "nsISupports.idl"
[scriptable, uuid(61c1b3c0-b1bf-11d3-93b6-00104ba0fd40)]
/*
* Simple mapping service interface.
* @status FROZEN
*/
[scriptable, uuid(78650582-4e93-4b60-8e85-26ebd3eb14ca)]
interface nsIProperties : nsISupports
{
/**
* Defines a new property.
* @return NS_ERROR_FAILURE if a property with that name already
* exists.
* Gets a property with a given name.
*
* @return NS_ERROR_FAILURE if a property with that name doesn't exist.
* @return NS_ERROR_NO_INTERFACE if the found property fails to QI to the
* given iid.
*/
void define(in string prop, in nsISupports initialValue);
void get(in string prop, in nsIIDRef iid,
[iid_is(iid),retval] out nsQIResult result);
/**
* Sets a property with a given name to a given value.
*/
void set(in string prop, in nsISupports value);
/**
* Returns true if the property with the given name exists.
*/
boolean has(in string prop);
/**
* Undefines a property.
@ -55,49 +73,12 @@ interface nsIProperties : nsISupports
void undefine(in string prop);
/**
* Gets a property with a given name.
* @return NS_ERROR_FAILURE if a property with that name doesn't
* exist.
* Returns an array of the keys.
*/
void get(in string prop, in nsIIDRef uuid,
[iid_is(uuid),retval] out nsQIResult result);
/**
* Sets a property with a given name to a given value.
* @return NS_ERROR_FAILURE if a property with that name doesn't
* exist.
*/
void set(in string prop, in nsISupports value);
/**
* Returns true if the property with the given name exists.
*/
boolean has(in string prop);
void getKeys(out PRUint32 count, [array, size_is(count), retval] out string keys);
};
%{C++
#define NS_PROPERTIES_CID \
{ /* 4de2bc90-b1bf-11d3-93b6-00104ba0fd40 */ \
0x4de2bc90, \
0xb1bf, \
0x11d3, \
{0x93, 0xb6, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
}
#define NS_PROPERTIES_CONTRACTID "@mozilla.org/properties;1"
#define NS_PROPERTIES_CLASSNAME "Properties"
#include "nsIComponentManager.h"
inline nsresult
NS_NewIProperties(nsISupports* outer, nsIProperties* *result)
{
static NS_DEFINE_CID(kPropertiesCID, NS_PROPERTIES_CID);
return nsComponentManager::CreateInstance(kPropertiesCID,
outer,
NS_GET_IID(nsIProperties),
(void**)result);
}
#define NS_PROPERTIES_CONTRACTID "@mozilla.org/properties;1"
#define NS_PROPERTIES_CLASSNAME "Properties"
%}

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

@ -437,18 +437,6 @@ nsPersistentProperties::SkipLine(PRInt32 c)
// XXX Some day we'll unify the nsIPersistentProperties interface with
// nsIProperties, but until now...
NS_IMETHODIMP
nsPersistentProperties::Define(const char* prop, nsISupports* initialValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPersistentProperties::Undefine(const char* prop)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPersistentProperties::Get(const char* prop, const nsIID & uuid, void* *result)
{
@ -460,6 +448,11 @@ nsPersistentProperties::Set(const char* prop, nsISupports* value)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPersistentProperties::Undefine(const char* prop)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPersistentProperties::Has(const char* prop, PRBool *result)
@ -467,6 +460,12 @@ nsPersistentProperties::Has(const char* prop, PRBool *result)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPersistentProperties::GetKeys(PRUint32 *count, char ***keys)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////////////
// PropertyElement
////////////////////////////////////////////////////////////////////////////////

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

@ -95,31 +95,6 @@ nsProperties::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
return NS_OK;
}
NS_IMETHODIMP
nsProperties::Define(const char* prop, nsISupports* initialValue)
{
nsCStringKey key(prop);
if (Exists(&key))
return NS_ERROR_FAILURE;
nsISupports* prevValue = (nsISupports*)Put(&key, initialValue);
NS_ASSERTION(prevValue == NULL, "hashtable error");
NS_IF_ADDREF(initialValue);
return NS_OK;
}
NS_IMETHODIMP
nsProperties::Undefine(const char* prop)
{
nsCStringKey key(prop);
if (!Exists(&key))
return NS_ERROR_FAILURE;
nsISupports* prevValue = (nsISupports*)Remove(&key);
NS_IF_RELEASE(prevValue);
return NS_OK;
}
NS_IMETHODIMP
nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
{
@ -148,6 +123,18 @@ nsProperties::Set(const char* prop, nsISupports* value)
return NS_OK;
}
NS_IMETHODIMP
nsProperties::Undefine(const char* prop)
{
nsCStringKey key(prop);
if (!Exists(&key))
return NS_ERROR_FAILURE;
nsISupports* prevValue = (nsISupports*)Remove(&key);
NS_IF_RELEASE(prevValue);
return NS_OK;
}
NS_IMETHODIMP
nsProperties::Has(const char* prop, PRBool *result)
{
@ -156,4 +143,10 @@ nsProperties::Has(const char* prop, PRBool *result)
return NS_OK;
}
NS_IMETHODIMP
nsProperties::GetKeys(PRUint32 *count, char ***keys)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////////////

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

@ -42,6 +42,14 @@
#include "nsHashtable.h"
#include "nsAgg.h"
#define NS_PROPERTIES_CID \
{ /* 4de2bc90-b1bf-11d3-93b6-00104ba0fd40 */ \
0x4de2bc90, \
0xb1bf, \
0x11d3, \
{0x93, 0xb6, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
}
class nsIUnicharInputStream;
class nsProperties : public nsIProperties, public nsHashtable {

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

@ -603,12 +603,6 @@ nsDirectoryService::~nsDirectoryService()
NS_IMPL_THREADSAFE_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectoryService, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2)
NS_IMETHODIMP
nsDirectoryService::Define(const char* prop, nsISupports* initialValue)
{
return Set(prop, initialValue);
}
NS_IMETHODIMP
nsDirectoryService::Undefine(const char* prop)
{
@ -618,6 +612,12 @@ nsDirectoryService::Undefine(const char* prop)
mHashtable->Remove (&key);
return NS_OK;
}
NS_IMETHODIMP
nsDirectoryService::GetKeys(PRUint32 *count, char ***keys)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
struct FileData