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
parent fbe1be6c59
commit 517b4e843b
13 changed files with 79 additions and 153 deletions

View File

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

View File

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

View File

@@ -42,7 +42,6 @@
#include "nsIXPConnect.h" #include "nsIXPConnect.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "nsMemory.h" #include "nsMemory.h"
#include "nsIRegistry.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsIXPCScriptable.h" #include "nsIXPCScriptable.h"
@@ -394,7 +393,6 @@ mozJSComponentLoader::mozJSComponentLoader()
: mRuntime(nsnull), : mRuntime(nsnull),
mModules(nsnull), mModules(nsnull),
mGlobals(nsnull), mGlobals(nsnull),
mXPCOMKey(0),
mInitialized(PR_FALSE) mInitialized(PR_FALSE)
{ {
NS_INIT_REFCNT(); NS_INIT_REFCNT();
@@ -486,15 +484,6 @@ mozJSComponentLoader::Init(nsIComponentManager *aCompMgr, nsISupports *aReg)
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return 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; return NS_OK;
} }
@@ -627,7 +616,6 @@ mozJSComponentLoader::SetRegistryInfo(const char *registryLocation,
nsresult nsresult
mozJSComponentLoader::RemoveRegistryInfo(nsIFile *component, const char *registryLocation) mozJSComponentLoader::RemoveRegistryInfo(nsIFile *component, const char *registryLocation)
{ {
nsresult rv;
if (!mLoaderManager) if (!mLoaderManager)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -639,7 +627,6 @@ PRBool
mozJSComponentLoader::HasChanged(const char *registryLocation, mozJSComponentLoader::HasChanged(const char *registryLocation,
nsIFile *component) nsIFile *component)
{ {
nsresult rv;
if (!mLoaderManager) if (!mLoaderManager)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;

View File

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

View File

@@ -529,28 +529,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid )
switch ( (nsWellKnownRegistry) regid ) { switch ( (nsWellKnownRegistry) regid ) {
case ApplicationComponentRegistry: case ApplicationComponentRegistry:
{ NS_WARNING("ApplicationComponentRegistry is unsupported!");
// 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;
}
}
break; break;
case ApplicationRegistry: case ApplicationRegistry:
{ {

View File

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

View File

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

View File

@@ -529,28 +529,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid )
switch ( (nsWellKnownRegistry) regid ) { switch ( (nsWellKnownRegistry) regid ) {
case ApplicationComponentRegistry: case ApplicationComponentRegistry:
{ NS_WARNING("ApplicationComponentRegistry is unsupported!");
// 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;
}
}
break; break;
case ApplicationRegistry: case ApplicationRegistry:
{ {

View File

@@ -37,15 +37,33 @@
#include "nsISupports.idl" #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 interface nsIProperties : nsISupports
{ {
/** /**
* Defines a new property. * Gets a property with a given name.
* @return NS_ERROR_FAILURE if a property with that name already *
* exists. * @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. * Undefines a property.
@@ -55,49 +73,12 @@ interface nsIProperties : nsISupports
void undefine(in string prop); void undefine(in string prop);
/** /**
* Gets a property with a given name. * Returns an array of the keys.
* @return NS_ERROR_FAILURE if a property with that name doesn't
* exist.
*/ */
void get(in string prop, in nsIIDRef uuid, void getKeys(out PRUint32 count, [array, size_is(count), retval] out string keys);
[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);
}; };
%{C++ %{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_CONTRACTID "@mozilla.org/properties;1"
#define NS_PROPERTIES_CLASSNAME "Properties" #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);
}
%} %}

View File

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

View File

@@ -95,31 +95,6 @@ nsProperties::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
return NS_OK; 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 NS_IMETHODIMP
nsProperties::Get(const char* prop, const nsIID & uuid, void* *result) nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
{ {
@@ -148,6 +123,18 @@ nsProperties::Set(const char* prop, nsISupports* value)
return NS_OK; 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 NS_IMETHODIMP
nsProperties::Has(const char* prop, PRBool *result) nsProperties::Has(const char* prop, PRBool *result)
{ {
@@ -156,4 +143,10 @@ nsProperties::Has(const char* prop, PRBool *result)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsProperties::GetKeys(PRUint32 *count, char ***keys)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@@ -42,6 +42,14 @@
#include "nsHashtable.h" #include "nsHashtable.h"
#include "nsAgg.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 nsIUnicharInputStream;
class nsProperties : public nsIProperties, public nsHashtable { class nsProperties : public nsIProperties, public nsHashtable {

View File

@@ -603,12 +603,6 @@ nsDirectoryService::~nsDirectoryService()
NS_IMPL_THREADSAFE_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectoryService, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2) NS_IMPL_THREADSAFE_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectoryService, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2)
NS_IMETHODIMP
nsDirectoryService::Define(const char* prop, nsISupports* initialValue)
{
return Set(prop, initialValue);
}
NS_IMETHODIMP NS_IMETHODIMP
nsDirectoryService::Undefine(const char* prop) nsDirectoryService::Undefine(const char* prop)
{ {
@@ -620,6 +614,12 @@ nsDirectoryService::Undefine(const char* prop)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsDirectoryService::GetKeys(PRUint32 *count, char ***keys)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
struct FileData struct FileData
{ {
FileData(const char* aProperty, FileData(const char* aProperty,