mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
Bug 347752 - Crash [@ MSVCR80.dll] when using nsIProperties service get method with null argumentp=Alfred Kayser <alfredkayser@nl.ibm.com>r=darin, sr=dougt
This commit is contained in:
parent
cb574d2844
commit
4f83fa46f3
@ -49,6 +49,8 @@ NS_INTERFACE_MAP_END
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
|
nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(prop);
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> value;
|
nsCOMPtr<nsISupports> value;
|
||||||
if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) {
|
if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -59,12 +61,16 @@ nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsProperties::Set(const char* prop, nsISupports* value)
|
nsProperties::Set(const char* prop, nsISupports* value)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(prop);
|
||||||
|
|
||||||
return Put(prop, value) ? NS_OK : NS_ERROR_FAILURE;
|
return Put(prop, value) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsProperties::Undefine(const char* prop)
|
nsProperties::Undefine(const char* prop)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(prop);
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> value;
|
nsCOMPtr<nsISupports> value;
|
||||||
if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value)))
|
if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value)))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -76,6 +82,8 @@ nsProperties::Undefine(const char* prop)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsProperties::Has(const char* prop, PRBool *result)
|
nsProperties::Has(const char* prop, PRBool *result)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(prop);
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> value;
|
nsCOMPtr<nsISupports> value;
|
||||||
*result = nsProperties_HashBase::Get(prop,
|
*result = nsProperties_HashBase::Get(prop,
|
||||||
getter_AddRefs(value));
|
getter_AddRefs(value));
|
||||||
@ -108,10 +116,12 @@ GetKeysEnumerate(const char *key, nsISupports* data,
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsProperties::GetKeys(PRUint32 *count, char ***keys)
|
nsProperties::GetKeys(PRUint32 *count, char ***keys)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(count);
|
||||||
|
NS_ENSURE_ARG(keys);
|
||||||
|
|
||||||
PRUint32 n = Count();
|
PRUint32 n = Count();
|
||||||
char ** k = (char **) nsMemory::Alloc(n * sizeof(char *));
|
char ** k = (char **) nsMemory::Alloc(n * sizeof(char *));
|
||||||
if (!k)
|
NS_ENSURE_TRUE(k, NS_ERROR_OUT_OF_MEMORY);
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
GetKeysEnumData gked;
|
GetKeysEnumData gked;
|
||||||
gked.keys = k;
|
gked.keys = k;
|
||||||
|
@ -530,6 +530,8 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectorySer
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDirectoryService::Undefine(const char* prop)
|
nsDirectoryService::Undefine(const char* prop)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(prop);
|
||||||
|
|
||||||
nsCStringKey key(prop);
|
nsCStringKey key(prop);
|
||||||
if (!mHashtable.Exists(&key))
|
if (!mHashtable.Exists(&key))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -608,6 +610,8 @@ static PRBool FindProviderFile(nsISupports* aElement, void *aData)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result)
|
nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(prop);
|
||||||
|
|
||||||
nsCStringKey key(prop);
|
nsCStringKey key(prop);
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> value = dont_AddRef(mHashtable.Get(&key));
|
nsCOMPtr<nsISupports> value = dont_AddRef(mHashtable.Get(&key));
|
||||||
@ -656,6 +660,8 @@ nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDirectoryService::Set(const char* prop, nsISupports* value)
|
nsDirectoryService::Set(const char* prop, nsISupports* value)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(prop);
|
||||||
|
|
||||||
nsCStringKey key(prop);
|
nsCStringKey key(prop);
|
||||||
if (mHashtable.Exists(&key) || value == nsnull)
|
if (mHashtable.Exists(&key) || value == nsnull)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@ -677,6 +683,8 @@ nsDirectoryService::Set(const char* prop, nsISupports* value)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDirectoryService::Has(const char *prop, PRBool *_retval)
|
nsDirectoryService::Has(const char *prop, PRBool *_retval)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_ARG(prop);
|
||||||
|
|
||||||
*_retval = PR_FALSE;
|
*_retval = PR_FALSE;
|
||||||
nsCOMPtr<nsIFile> value;
|
nsCOMPtr<nsIFile> value;
|
||||||
nsresult rv = Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(value));
|
nsresult rv = Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(value));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user