зеркало из https://github.com/mozilla/pjs.git
Bug 3344605. nsIPropertyBag2 should grow a non-throwing get() and hasKey(). r=darin, sr=shaver
This commit is contained in:
Родитель
eb81b7da02
Коммит
d781a030d0
|
@ -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);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче