NS_IMETHODIMP
HTMLOptionsCollection::NamedItem(const nsAString& aName,
                                 nsIDOMNode** aReturn)
{
  NS_IF_ADDREF(*aReturn = GetNamedItem(aName));

  return NS_OK;
}
Example #2
0
NS_IMETHODIMP
nsDOMStorageList::NamedItem(const nsAString& aDomain,
                            nsIDOMStorageObsolete** aStorage)
{
  nsresult rv;
  NS_IF_ADDREF(*aStorage = GetNamedItem(aDomain, &rv));
  return rv;
}
Example #3
0
NS_IMETHODIMP
nsPluginElement::NamedItem(const nsAString& aName, nsIDOMMimeType** aReturn)
{
  nsresult rv;

  NS_IF_ADDREF(*aReturn = GetNamedItem(aName, &rv));

  return rv;
}
Example #4
0
NS_IMETHODIMP
nsDOMStorage::GetItem(const nsAString& aKey, nsIDOMStorageItem **aItem)
{
  nsresult rv;

  NS_IF_ADDREF(*aItem = GetNamedItem(aKey, &rv));

  return rv;
}
NS_IMETHODIMP
nsDOMAttributeMap::GetNamedItem(const nsAString& aAttrName,
                                nsIDOMNode** aAttribute)
{
  NS_ENSURE_ARG_POINTER(aAttribute);

  nsresult rv;
  NS_IF_ADDREF(*aAttribute = GetNamedItem(aAttrName, &rv));

  return rv;
}
Example #6
0
NS_IMETHODIMP
nsPluginArray::NamedItem(const nsAString& aName, nsIDOMPlugin** aReturn)
{
  NS_PRECONDITION(nsnull != aReturn, "null arg");

  nsresult rv;

  NS_IF_ADDREF(*aReturn = GetNamedItem(aName, &rv));

  return rv;
}
JSObject*
HTMLOptionsCollection::NamedItem(JSContext* cx, const nsAString& name,
                                 ErrorResult& error)
{
  nsINode* item = GetNamedItem(name);
  if (!item) {
    return nullptr;
  }
  JS::Rooted<JSObject*> wrapper(cx, nsWrapperCache::GetWrapper());
  JSAutoCompartment ac(cx, wrapper);
  JS::Rooted<JS::Value> v(cx);
  if (!mozilla::dom::WrapObject(cx, wrapper, item, item, nullptr, &v)) {
    error.Throw(NS_ERROR_FAILURE);
    return nullptr;
  }
  return &v.toObject();
}