2011-05-20 10:23:49 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-05-20 10:23:49 -07:00
|
|
|
|
|
|
|
#ifndef nsDOMStringMap_h
|
|
|
|
#define nsDOMStringMap_h
|
|
|
|
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsString.h"
|
2012-10-16 18:09:42 -07:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "nsGenericHTMLElement.h"
|
2013-08-23 19:42:42 -07:00
|
|
|
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
|
2011-05-20 10:23:49 -07:00
|
|
|
|
2012-11-05 08:58:03 -08:00
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
|
|
|
}
|
|
|
|
|
2013-06-17 13:31:03 -07:00
|
|
|
class nsDOMStringMap : public nsStubMutationObserver,
|
2012-10-16 18:09:42 -07:00
|
|
|
public nsWrapperCache
|
2011-05-20 10:23:49 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2012-10-16 18:09:42 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMStringMap)
|
|
|
|
|
2013-06-17 13:31:03 -07:00
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
|
2012-10-16 18:09:42 -07:00
|
|
|
nsINode* GetParentObject()
|
|
|
|
{
|
|
|
|
return mElement;
|
|
|
|
}
|
|
|
|
|
2014-09-01 17:49:25 -07:00
|
|
|
explicit nsDOMStringMap(nsGenericHTMLElement* aElement);
|
2011-05-20 10:23:49 -07:00
|
|
|
|
2012-11-05 08:58:03 -08:00
|
|
|
// WebIDL API
|
2014-04-08 15:27:18 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
|
2013-05-10 15:57:58 -07:00
|
|
|
void NamedGetter(const nsAString& aProp, bool& found,
|
|
|
|
mozilla::dom::DOMString& aResult) const;
|
2012-11-05 08:58:03 -08:00
|
|
|
void NamedSetter(const nsAString& aProp, const nsAString& aValue,
|
|
|
|
mozilla::ErrorResult& rv);
|
|
|
|
void NamedDeleter(const nsAString& aProp, bool &found);
|
2014-04-15 19:58:44 -07:00
|
|
|
bool NameIsEnumerable(const nsAString& aName);
|
2014-04-15 19:58:44 -07:00
|
|
|
void GetSupportedNames(unsigned, nsTArray<nsString>& aNames);
|
2011-05-20 10:23:49 -07:00
|
|
|
|
2013-06-17 13:31:03 -07:00
|
|
|
js::ExpandoAndGeneration mExpandoAndGeneration;
|
|
|
|
|
2011-05-20 10:23:49 -07:00
|
|
|
private:
|
|
|
|
virtual ~nsDOMStringMap();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsRefPtr<nsGenericHTMLElement> mElement;
|
|
|
|
// Flag to guard against infinite recursion.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mRemovingProp;
|
2013-05-10 15:57:58 -07:00
|
|
|
static bool DataPropToAttr(const nsAString& aProp, nsAutoString& aResult);
|
|
|
|
static bool AttrToDataProp(const nsAString& aAttr, nsAutoString& aResult);
|
2011-05-20 10:23:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|