2011-05-20 17:23:49 +00: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 11:12:37 +00: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 17:23:49 +00:00
|
|
|
|
|
|
|
#ifndef nsDOMStringMap_h
|
|
|
|
#define nsDOMStringMap_h
|
|
|
|
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsString.h"
|
2012-10-17 01:09:42 +00:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "nsGenericHTMLElement.h"
|
2013-08-24 02:42:42 +00:00
|
|
|
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
|
2011-05-20 17:23:49 +00:00
|
|
|
|
2012-11-05 16:58:03 +00:00
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
|
|
|
}
|
|
|
|
|
2013-06-17 20:31:03 +00:00
|
|
|
class nsDOMStringMap : public nsStubMutationObserver,
|
2012-10-17 01:09:42 +00:00
|
|
|
public nsWrapperCache
|
2011-05-20 17:23:49 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2012-10-17 01:09:42 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMStringMap)
|
|
|
|
|
2013-06-17 20:31:03 +00:00
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
|
2012-10-17 01:09:42 +00:00
|
|
|
nsINode* GetParentObject()
|
|
|
|
{
|
|
|
|
return mElement;
|
|
|
|
}
|
|
|
|
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit nsDOMStringMap(nsGenericHTMLElement* aElement);
|
2011-05-20 17:23:49 +00:00
|
|
|
|
2012-11-05 16:58:03 +00:00
|
|
|
// WebIDL API
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-05-10 22:57:58 +00:00
|
|
|
void NamedGetter(const nsAString& aProp, bool& found,
|
|
|
|
mozilla::dom::DOMString& aResult) const;
|
2012-11-05 16:58:03 +00:00
|
|
|
void NamedSetter(const nsAString& aProp, const nsAString& aValue,
|
|
|
|
mozilla::ErrorResult& rv);
|
|
|
|
void NamedDeleter(const nsAString& aProp, bool &found);
|
2014-04-16 02:58:44 +00:00
|
|
|
bool NameIsEnumerable(const nsAString& aName);
|
2014-04-16 02:58:44 +00:00
|
|
|
void GetSupportedNames(unsigned, nsTArray<nsString>& aNames);
|
2011-05-20 17:23:49 +00:00
|
|
|
|
2013-06-17 20:31:03 +00:00
|
|
|
js::ExpandoAndGeneration mExpandoAndGeneration;
|
|
|
|
|
2011-05-20 17:23:49 +00:00
|
|
|
private:
|
|
|
|
virtual ~nsDOMStringMap();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsRefPtr<nsGenericHTMLElement> mElement;
|
|
|
|
// Flag to guard against infinite recursion.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mRemovingProp;
|
2013-05-10 22:57:58 +00:00
|
|
|
static bool DataPropToAttr(const nsAString& aProp, nsAutoString& aResult);
|
|
|
|
static bool AttrToDataProp(const nsAString& aAttr, nsAutoString& aResult);
|
2011-05-20 17:23:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|