Bug 3344605. nsIPropertyBag2 should grow a non-throwing get() and hasKey(). r=darin, sr=shaver

This commit is contained in:
sayrer%gmail.com 2006-08-20 16:42:08 +00:00
Родитель eb81b7da02
Коммит d781a030d0
2 изменённых файлов: 28 добавлений и 1 удалений

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

@ -87,6 +87,22 @@ nsHashPropertyBag::Init()
return NS_OK;
}
NS_IMETHODIMP
nsHashPropertyBag::HasKey(const nsAString& name, PRBool *aResult)
{
*aResult = mPropertyHash.Get(name, nsnull);
return NS_OK;
}
NS_IMETHODIMP
nsHashPropertyBag::Get(const nsAString& name, nsIVariant* *_retval)
{
mPropertyHash.Get(name, _retval);
return NS_OK;
}
NS_IMETHODIMP
nsHashPropertyBag::GetProperty(const nsAString& name, nsIVariant* *_retval)
{

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

@ -39,7 +39,7 @@
#include "nsIPropertyBag.idl"
[scriptable, uuid(9bb35f13-0096-4a31-833a-acd97001132d)]
[scriptable, uuid(625cfd1e-da1e-4417-9ee9-dbc8e0b3fd79)]
interface nsIPropertyBag2 : nsIPropertyBag
{
// Accessing a property as a different type may attempt conversion to the
@ -61,4 +61,15 @@ interface nsIPropertyBag2 : nsIPropertyBag
void getPropertyAsInterface (in AString prop,
in nsIIDRef iid,
[iid_is(iid), retval] out nsQIResult result);
/**
* This method returns null if the value does not exist,
* or exists but is null.
*/
nsIVariant get (in AString prop);
/**
* Check for the existence of a key.
*/
PRBool hasKey (in AString prop);
};